linux作业

(一)基本操作题
1、在系统中以自己名字首字母创建账号,该账号密码为123456,该账号所属组为hehe;创建hehecici账号,该账号密码为123456。
groupadd hehe
useradd lly
passwd lly
useradd hehecici
passwd hehecici
2、在/root/hehe/haha目录下创建文件a和b,a文件内容为aaaaa,b文件内容为bbbbb,其中a的所有者和所属组为root:hehe,b的所有者和所属组为自己名字首字母账号:hehe.
mkdir -p hehe/haha
cd hehe/haha
vim a
vim b
chown root:hehe a
chown lly:hehe b
3、a文件所有者可读、可写、不可执行,所属组不可读、可写、可执行,其他人不可读、不可写、可执行.
chmod 631 a
4、b文件所有人不可读、不可写、不可执行。
chmod 0 b
5、复制b文件,复制后的文件名为c。
cp b c

一、ftp环境搭建
1.安装vsftpd和ftp
yum install -y vsftpd
yum install -y ftp
cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.bak //备份vsftpd.conf配置文件
grep -v “#” /etc/vsftpd/vsftpd.conf.bak > /etc/vsftpd/vsftpd.conf //删除注释语句
setenforce 0
systemctl stop firewalld
2.修改配置文件并创建hehecici以及自己名字首字母的帐号。
vim /etc/vsftpd/vsftpd.conf
anonymous_enable=NO
anon_umask=022
local_enable=YES
guest_enable=YES
guest_username=lly
allow_writeable_chroot=YES
write_enable=YES
local_umask=022
local_root=/root/hehe/haha
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen_port=2231
listen=NO
listen_ipv6=YES
pam_service_name=vsftpd.vu
userlist_enable=YES
tcp_wrappers=YES
user_config_dir=/etc/vsftpd/vusers_dir
pasv_min_port=45000
pasv_max_port=49000

vim /etc/vsftpd/vuser.txt
hehecici
123456
lly
123456
db_load -T -t hash -f /etc/vsftpd/vuser.txt /etc/vsftpd/vuser.db //哈希算法txt变db
chmod 600 /etc/vsftpd/vuser.db
chmod -Rf 777 /root/hehe/haha/ //直接给777防止麻烦
vim /etc/pam.d/vsftpd.vu
auth required pam_userdb.so db=/etc/vsftpd/vuser
account required pam_userdb.so db=/etc/vsftpd/vuser
3.要求hehecici能上传下载,自己的账号能上传不能下载。
mkdir /etc/vsftpd/vusers_dir
vim /etc/vsftpd/vusers_dir/hehecici
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES

vim /etc/vsftpd/vusers_dir/lly
anon_upload_enable=YES
download_enable=NO
anon_mkdir_write_enable=YES
anon_other_write_enable=YES

systemctl start vsftpd.service //启动FTP
4.演示
vim test.txt

ftp localhost 2231
hehecici
123456
put test.txt
get test.txt
exit

=============================
ftp localhost 2231
lly
123456

put test.txt
get test.txt         //下载txt
exit

=============================

二、samba环境搭建
1.安装samba
yum install -y samba
systemctl stop firewalld
setenforce 0
systemctl start smb nmb
yum install -y samba-client
2.创建共享目录及共享账号
mkdir -p /root/hehe/haha
smbpasswd -a hehecici
smbpasswd -a lly
3.设置共享配置文件
vim /etc/samba/smb.conf
[haha]
comment = shared
path = /root/hehe/haha
valid users = hehecici lly
write list = hehecici lly
4.查看共享目录设定权限并添加测试文件
ll -d /root/hehe/haha
chmod -R 777 /root(若出现 read only则 yum -y install cifs-utils)
echo aaa > /root/hehe/haha/test.txt
systemctl restart smb nmb
(若进不去,可尝试 yum -y install cifs-utils )
5.挂载smb
mkdir /hehecici
mkdir /lly
mount //172.19.222.42/haha /hehecici -o username=“hehecici”,password=“123456”
mount //172.19.222.42/haha /lly -o username=“lly”,password=“123456”
smbclient //172.19.222.42/haha -U hehecici

put test.txt
get test.txt
exit

smbclient //172.19.222.42/haha -U lly

put test.txt
在Xshell中新建会话窗口
修改test.txt文件权限为0,输入如下命令:
chmod 0 /root/hehe/haha/test.txt
然后返回到smb操作窗口继续执行get test.txt命令:
get test.txt
显示NT_STATUS_ACCESS_DENIED opening remote file \test.txt,即成功。
exit

三、搭建lamp环境(安装discuz,ecshop,wordpress要搭建lamp环境)
1.安装Apache
yum install -y httpd
2.安装Mysql57
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
yum localinstall -y mysql57-community-release-el7-8.noarch.rpm
yum install -y mysql-community-server
systemctl start mysqld
grep ‘temporary password’ /var/log/mysqld.log //查看mysql密码
mysql -uroot -p
密码为:@localhost:后面的,复制,粘贴
set global validate_password_policy=0; //修改密码规则(8位就行)
ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘12345678’;
quit;
3.安装php70w
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm --nodeps --force

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
以下是一行代码:
yum -y install php70w php70w-cli php70w-common php70w-devel php70w-embedded php70w-fpm php70w-gd php70w-mbstring php70w-mysqlnd php70w-opcache php70w-pdo php70w-xml
(若安装缺少东西,则:yum -y install php* --skip-broken)

四、框架搭建(一定看清上传的是文件夹还是文件夹内的文件)
1.discuz
将文件解压,upload内文件上传到/var/www/html 目录下
cp -rf /root/Discuz/upload/* /var/www/html
chmod -R 777 /var/www/html
systemctl restart mysqld
systemctl restart httpd
浏览器访问IP 139.196.120.42/install
安装时数据库密码为:12345678
管理员密码随意设。
删除:rm -rf /var/www/html/*
2.ecshop
将文件解压,appserver文件夹上传到/var/www 目录下
ecshop内文件上传到/var/www/html 目录下
cp -rf /root/ECShop/ECShop_V4.0.0_UTF8_release20190603/source/appserver/ /var/www
cp -rf /root/ECShop/ECShop_V4.0.0_UTF8_release20190603/source/ecshop/* /var/www/html/
chmod -R 777 /var/www/
systemctl restart httpd
systemctl restart mysqld
浏览器访问IP 139.196.120.42
安装完后另开窗口再次输入139.196.120.42
数据库名随便写,密码为12345678
管理员:liuluyi(随便写)
密码luyi123456
删除:rm -rf /var/www/html/*
3.wordpress
将文件解压,wordpress内文件上传到/var/www/html 目录下
cp -rf /root/wordpress/* /var/www/html/
chmod -R 777 /var/www/html
mysql -uroot -p
create database wordpress;
exit
浏览器直接访问IP 139.196.120.42/wp-admin/install.php
username:root
password:12345678

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值