自己编写的脚本方便以后使用,自己用的脚本,没有对vsftpd安装状态进行检测,所以最好安装完后,把第一个选项去掉,要不选错了就等于重装了vsftpd,vsftpd.conf文件直接使用配置好了远程下载替换本地的
#!/bin/bash #author : merci #Only apply centos6.x function install_vsftpd(){ yum remove vsftpd -y rm -rf /etc/vsftpd yum install vsftpd -y touch /etc/vsftpd/chroot_list rm -rf /etc/vsftpd/vsftpd.conf wget -P /etc/vsftpd https://sulao.cn/tool/vsftpd/vsftpd.conf #直接下载配置好的配置文件,免得麻烦 /etc/init.d/vsftpd start chkconfig vsftpd on } function add_ftpuser(){ CHECKFTP=`ps -ef| grep 'vsftpd'` if [ ! -n "$CHECKFTP" ] then echo -e "Not found vsftpd service, Plaese install it !" exit 1 else read -p "Please input your username : " x read -p "Please input your password : " y read -p "Please set your directory : " z mkdir -p $z useradd -d $z -s /sbin/nologin -M $x -g ftp echo "$x" >> /etc/vsftpd/chroot_list echo "$y" | passwd --stdin $x chmod -R 777 $z /etc/init.d/vsftpd restart echo -e "Add user successfly ! \n your new account is $x, password is $y, your directory is $z " fi } echo "Select id " echo -e "1.Install vsftpd service \n2.Add vsftpd user"; read -p "Please choose id :" c case $c in 1 ) install_vsftpd ;; 2 ) add_ftpuser ;; * ) echo "Please choose correct" ;; esac