#!/bin/bash
#This is install vsftpd script
mount /dev/sr0 /mnt/
yum -y install vsftpd
echo "w1 123 w2 123 w3 123" >/etc/vsftpd/user
db_load -T -t hash -f /etc/vsftpd/user /etc/vsftpd/user.db
echo "#PAM-1.0 auth required pam_usredb.so db=/etc/vsftpd/user account required pam_userdb.so db=/etc/vsftpd/user" >/etc/pam.d/xiaoxiannv
useradd -m -s /sbin/nologin duanyufei
sed -i '/^#/d' /etc/vsftpd/vsftpd.conf sed -i '1a anon_root=/ftproot/\nguest_enable=YES\nguest_username=duanyufei\nuser_config_dir=/etc/vsftpd/virtual' /etc/vsftpd/vsftpd.conf sed -i '/^pam/ s/vsftpd/xiaoxiannv/' /etc/vsftpd/vsftpd.conf sed -i '$a pasv_enable=YES\npasv_min_port=10000\npasv_max_port=11000' /etc/vsftpd/vsftpd.conf
mkdir /etc/vsftpd/virtual
mkdir -p /ftproot/anonymous/
chmod 757 /ftproot/anonymous/
touch /etc/vsftpd/virtual/w2
touch /etc/vsftpd/virtual/w3
echo "anon_upload_enable=YES anon_mkdir_write_enable=YES anon_other_write_enable=YES" >/etc/vsftpd/virtual/w1
/etc/init.d/vsftpd start chkconfig --level 35 vsftpd on