(一)基本操作题
1、在系统中以自己名字首字母创建账号,该账号密码为123456,该账号所属组为hehe;创建hehecici账号,该账号密码为123456。
groupadd hehe
useradd zyj
passwd 123456
useradd hehecici
passwd 123456
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 zyj: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
systemctl stop firewalld
2.创建共享目录,并禁止匿名登录
mkdir -p /root/hehe/haha
vim /etc/vsftpd/vsftpd.conf
anonymous_enable=NO
3.配置虚拟用户登录
vim /etc/pam.d/vsftpd
#%PAM-1.0
#session optional pam_keyinit.so force revoke
#auth required pam_listfile.so item=user sense=deny file=/etc/vsftpd/ftpusers onerr=succeed
#auth required pam_shells.so
#auth include password-auth
#account include password-auth
#session required pam_loginuid.so
#session include password-auth
auth required /lib64/security/pam_userdb.so db=/etc/vsftpd/vuser_passwd
account required /lib64/security/pam_userdb.so db=/etc/vsftpd/vuser_passwd
4.创建虚拟账号
vim /etc/vsftpd/vuser_passwd.txt
hehecici
123456
zyj
123456
db_load -T -t hash -f vuser_passwd.txt vuser_passwd.db
5.配置虚拟账号权限
mkdir vuser_conf
vim vuser_conf/hehecici
local_root=/root/hehe/haha
anon_umask=022
anon_world_readable_only=NO
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
vim vuser_conf/zyj
local_root=/root/hehe/haha
anon_umask=022
anon_upload_enable=YES
download_enable=NO
6.配置vsftpd主配置
vim /etc/vsftpd/vsftpd.conf
ascii_upload_enable=YES
ascii_download_enable=YES
chroot_local_user=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
guest_enable=YES
guest_username=zyj
user_config_dir=/etc/vsftpd/vuser_conf
allow_writeable_chroot=YES
pasv_promiscuous=YES
7.systemctl start vsftpd
chmod -R 777 /root/hehe/haha
创建两个测试文件进行测试
ftp 47.101.178.85
二、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 zyj
pdbedit -L
注:smbpasswd -x 用户名 删除samba用户
3.设置共享配置文件
vim /etc/samba/smb.conf
[haha]
comment = This is sharing
path = /root/hehe/haha
valid users = hehecici zyj
writable = yes
admin users = hehecici zyj
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 /zyj
// smbclient -L //47.101.178.85 -U hehecici // */先不用这条语句
mount //47.101.178.85/haha /hehecici -o username=“hehecici”,password=“123456”
cd /hehecici df查看挂载
smbclient //47.101.178.85/haha -U hehecici
put test.txt
get test.txt
mount //47.101.178.85/haha /zyj -o username=“zyj”,password=“123456”
smbclient //47.101.178.85/haha -U zyj
put test.txt
get test.txt
2:张雨晴版lamp
1.安装samba
yum install -y samba
yum install -y samba-client
systemctl start smb nmb
2.创建共享目录和共享账号
mkdir -p /root/hehe/haha
smbpasswd -a hehecici
smbpasswd -a zyj
3.设置共享文件
vi /etc/samba/smb.conf
[zyj]
comment = This is sharing
path = /root/hehe/haha
valid users = hehecici zyj
writeable = yes
write list = hehecici
read list = zyj
4.修改共享目录权限,添加测试文件
chmod -R 755 /root
echo qweasd > /root/hehe/haha/test.txt
systemctl restart smb nmb
5.设置挂载点的目录
mkdir /root/hehecici
mkdir /root/zyj
6.挂载共享目录
mbclient -L //IP -U hehecici 查看共享目录
mount //IP/zyj /root/hehecici -o username=“hehecici”,password=你自己设置的密码
mount //IP/zyj /root/zyj -o username=“zyj”,password=你自己设置的密码
7.挂载成功后进入目录可以进行权限的查看
hehecici目录能查看也能修改
zyj目录只能查看不能修改
三、搭建lamp环境
搭建法一(姚腾达版):
yum -y install httpd
systemctl start httpd 【启动httpd命令】
systemctl enable httpd 【设置httpd开机启动】
systemctl status httpd 【查看是否启动命令】
yum -y install mariadb-server mariadb
systemctl start mariadb
systemctl enable mariadb
systemctl status mariadb
mysql_secure_installation
mysql -uroot -p
show databases; 【命令显示数据库列表】
yum -y install php
yum -y install php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel
systemctl restart httpd
地址:https://jingyan.baidu.com/article/4d58d54165aaf79dd5e9c058.html
搭建法二(高文晓版):
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
将文件解压,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 47.101.178.85/install
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 47.101.178.85
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;
浏览器直接访问IP 47.101.178.85/wp-admin/install.php
https://blog.youkuaiyun.com/gao_2109/article/details/88827373
https://yq.aliyun.com/articles/701538?spm=a2c4e.11155472.0.0.78094591Auajmm
https://blog.youkuaiyun.com/matengbing/article/details/80264977