自己编写的脚本方便以后使用,自己用的脚本,没有对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 http://www.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内容版权声明:除非注明,否则皆为本站原创文章。
相关阅读
- linux下bash操作字符串常见方法整理
- k8s集群中mongdb、etcd、prometheus数据bash一键备份脚本
- k8s业务pod端口检测和日志采集bash脚本
- k8s基于clusterrole生成集群级别只读用户bash脚本
- centos7安装CUDA Tookit+CUDA Samples+NCCL+OpenMPI
- centos添加交换分区swap的方法
- centos7升级systemd并切换cgroup v1到cgroup v2
- centos7下程序运行提示报错version `GLIBCXX_3.4.20` not found
- centos7二进制部署prometheus+alertmanager+grafana
- centos7使用chrony配置时间同步服务
评论列表