centos6添加删除vsftpd用户bash脚本
- 2017-09-07 17:59:03
- 脚本
- 21
- shevechco
方便以后直接使用,直接在这里记录下!系统约定,vsftpd目录/etc/vsftpd,FTP根目录/data/www
#!/bin/bash #author : merci function add_ftpuser(){ read -p "Please input your ftp username : " x read -p "Please input your ftp password : " y ftpuserdir="/var/mail/$x" if [ ! -f "$ftpuserdir" ] then mkdir -p /data/www/$x useradd -d /data/www/$x -s /sbin/nologin -M $x -g ftp echo "$x" >> /etc/vsftpd/chroot_list echo "$y" | passwd --stdin $x chmod -R 777 /data/www/$x /etc/init.d/vsftpd restart echo -e "Add user successfly ! \n your new account is $x, password is $y, your directory is /data/www/$x " else echo -e "Ftp user directory already exist !" exit 0 fi } function del_ftpuser(){ read -p "Please input ftp username : " x ftpuserdir="/var/mail/$x" if [ ! -f "$ftpuserdir" ] then echo -e "Ftp user directory not exist !" exit 0 else userdel -r $x >/dev/null 2>&1 userlist=`cat /etc/vsftpd/chroot_list` echo "" > /etc/vsftpd/chroot_list for a in $userlist do if [ $a != "$x" ] then echo "$a" > /etc/vsftpd/chroot_list else continue fi done echo -e "Delete ftp user successfly !" fi } function list_ftpuser(){ userlist=`cat /etc/vsftpd/chroot_list` for a in $userlist do echo $a done } echo -e "1.Add vsftpd user \n2.Delete vsftpd user \n3.List all vsftpd user "; read -p "Please choose id :" c case $c in 1 ) add_ftpuser ;; 2 ) del_ftpuser ;; 3 ) list_ftpuser ;; * ) echo "Please choose correct" ;; esac
内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:http://www.sulao.cn/post/423
相关推荐
- k8s基于clusterrole生成集群级别只读用户bash脚本
- centos7安装CUDA Tookit+CUDA Samples+NCCL+OpenMPI
- centos7添加交换分区swap
- centos7升级systemd并切换cgroup v1到cgroup v2
- centos7下程序运行提示报错version `GLIBCXX_3.4.20` not found
- centos7安装GUI图形界面
- centos7使用haproxy部署k8s高可用集群
- centos7删除POD一直Terminating无法销毁
- centos7下载软件所有依赖包并搭建本地yum仓库
- centos7编译安装python3.9