(一)基本操作题
1、在系统中以自己名字首字母创建账号,该账号密码为123456,该账号所属组为hehe;创建hehecici账号,该账号密码为123456。
groupadd hehe
useradd cjx
passwd cjx
useradd hehecici
passwd hehecici
2、在/root/hehe/haha目录下创建文件a和b,a文件内容为aaaaa,b文件内容为bbbbb,其中a的所有者和所属组为root:hehe,b的所有者和所属组为自己名字首字母账号:hehe.
mkdir -p hehe/haha
vim a
vim b
chown root:hehe a
chown cjx: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=cjx
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
cjx
123456
db_load -T -t hash -f /etc/vsftpd/vuser.txt /etc/vsftpd/vuser.db //哈希算法txt变db
chmod 600 /etc/vsftpd/vuser.db (若不能正常启动FTP可将权限改为777,chmod 777 /etc/vsftpd)
chmod -R 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能上传下载,x能上传不能下载。
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/cjx
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
cjx
123456
lcd /usr/tmp //指定下载路径
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 cjx
3.设置共享配置文件
vim /etc/samba/smb.conf
[haha]
comment = This is sharing
path = /root/hehe/haha
valid users = hehecici cjx
writable = yes
admin users = hehecici cjx
4.查看共享目录设定权限并添加测试文件
ll -d /root/hehe/haha
chmod -R 755 /root(若出 read only 则将权限给为777,若还不行,则 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 /cjx
// smbclient -L //47.103.192.34 -U hehecici // */先不用这条语句47.103.192.34
mount //47.103.192.34/haha /hehecici -o username=“hehecici”,password=“123456”
mount //172.17.118.210/haha /cjx -o username=“cjx”,password=“123456”
smbclient //172.17.118.210/haha -U hehecici
put test.txt
get test.txt
smbclient //172.17.118.210/haha -U cjx
put test.txt
get test.txt
三、搭建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
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
四、框架搭建(一定看清上传的是文件夹还是文件夹内的文件)
1.discuz
将文件解压,使用xftp将upload内文件上传到/var/www/html 目录下
chmod -R 777 /var/www/html
systemctl restart mysqld
systemctl restart httpd
浏览器访问IP 47.103.192.34/install
2.ecshop
将文件解压,
将appserver文件夹上传到/var/www 目录下
将ecshop内文件上传到/var/www/html 目录下
chmod -R 777 /var/www/
systemctl restart httpd
systemctl restart mysqld
浏览器访问IP 47.103.192.34
3.wordpress
将文件解压,wordpress内文件上传到/var/www/html 目录下
chmod -R 777 /var/www/html
mysql -uroot -p
create database wordpress;
浏览器直接访问IP 47.103.192.34/wp-admin/install.php