前面送上ubuntu vsftpd一鍵安裝shell腳本,此次也管理vsftpd的腳本也一併奉獻,轉載標明:hcjavascriptjavascript
增長用戶java
#!/bin/bash read -p "Account: " account fpath=/home/vsftpd/$account if [ -e $fpath ] then echo "ERROR: User is exists! " exit else read -p "Password: " password if [ $account = $password ] then echo "ERROR:Account and Password same " exit fi echo $account >> /home/vsftpd_login echo $password >> /home/vsftpd_login rm -rf /etc/vsftpd_login.db db5.1_load -T -t hash -f /home/vsftpd_login /etc/vsftpd_login.db mkdir $fpath $fpath/www chmod a-w $fpath chmod 777 $fpath/www echo "MESSAGE: success! " cp -p /etc/vsftpd_user_conf/default /etc/vsftpd_user_conf/$account echo 'local_root='$fpath >> /etc/vsftpd_user_conf/$account service vsftpd restart fi
刪除用戶shell
#!/bin/bash read -p "Account: " account fpath=/home/vsftpd/$account if [ -e $fpath ] then sed "/$account/{N;d}" /home/vsftpd_login > /home/temp cat /home/temp > /home/vsftpd_login rm -rf temp rm -rf /etc/vsftpd_login.db db5.1_load -T -t hash -f /home/vsftpd_login /etc/vsftpd_login.db rm -rf $fpath rm -rf /etc/vsftpd_user_conf/$account echo "MESSAGE: Del success! " service vsftpd restart else echo "ERROR: User not fond! " exit fi