linux——安裝vsftp及配置虛擬匿名用戶腳本
systemctl disable firewalld
systemctl stop firewalld
setenforce 0
cd /etc/yum.repos.d/
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
yum clean all
yum -y install epel-release
yum -y install vsftpd
echo ‘user1‘ >> /etc/vsftpd/vu.list
echo ‘123‘ >> /etc/vsftpd/vu.list
echo ‘user2‘ >> /etc/vsftpd/vu.list
echo ‘user3‘ >> /etc/vsftpd/vu.list
echo ‘123‘ >> /etc/vsftpd/vu.list
yum -y install db4
db_load -T -t hash -f /etc/vsftpd/vu.list /etc/vsftpd/vu.db
chmod 600 /etc/vsftpd/vu.
useradd -d /var/ftproot -s /sbin/nologin vftp
chmod 755 /var/ftproot/
cp /etc/pam.d/vsftpd /etc/pam.d/vsftpd.bak
cat >/etc/pam.d/vsftpd<<EOF
auth required pam_userdb.so db=/etc/vsftpd/vu
account required pam_userdb.so db=/etc/vsftpd/vu
EOF
mkdir /etc/vsftpd/vusers_dir
echo ‘guest_enable=YES‘ >> /etc/vsftpd/vsftpd.conf
echo ‘guest_username=vftp‘ >> /etc/vsftpd/vsftpd.conf
echo ‘user_config_dir=/etc/vsftpd/vusers_dir‘ >> /etc/vsftpd/vsftpd.conf
sed -ri "s/^(anonymous_enable=).*/\1YES/g" /etc/vsftpd/vsftpd.conf
echo ‘anon_umask=022‘ >> /etc/vsftpd/vusers_dir/user1
echo ‘anon_upload_enable=YES‘ >> /etc/vsftpd/vusers_dir/user1
echo ‘anon_mkdir_write_enable=YES‘ >> /etc/vsftpd/vusers_dir/user1
echo ‘anon_other_write_enable=YES‘ >> /etc/vsftpd/vusers_dir/user1
touch /etc/vsftpd/vusers_dir/user2
systemctl start vsftpd
ss -antl
linux——安裝vsftp及配置虛擬匿名用戶腳本