centos6一键vsftpd安装bash脚本

自己编写的脚本方便以后使用,自己用的脚本,没有对vsftpd安装状态进行检测,所以最好安装完后,把第一个选项去掉,要不选错了就等于重装了vsftpd,vsftpd.conf文件直接使用配置好了远程下载替换本地的

01.
#!/bin/bash
02.
#author : merci
03.
#Only apply centos6.x
04.
05.
function install_vsftpd(){
06.
yum remove vsftpd -y
07.
rm -rf /etc/vsftpd
08.
yum install vsftpd -y
09.
touch /etc/vsftpd/chroot_list
10.
rm -rf /etc/vsftpd/vsftpd.conf
11.
wget -P /etc/vsftpd http://www.sulao.cn/tool/vsftpd/vsftpd.conf #直接下载配置好的配置文件,免得麻烦 
12.
/etc/init.d/vsftpd start
13.
chkconfig vsftpd on
14.
}
15.
function add_ftpuser(){
16.
CHECKFTP=`ps -ef| grep 'vsftpd'`
17.
if [ ! -n "$CHECKFTP" ]
18.
then
19.
echo -e "Not found vsftpd service, Plaese install it !"
20.
exit 1
21.
else
22.
read -p "Please input your username : " x
23.
read -p "Please input your password : " y
24.
read -p "Please set your directory : " z
25.
mkdir -p $z
26.
useradd -d $z -s /sbin/nologin -M $x -g ftp
27.
echo "$x" >> /etc/vsftpd/chroot_list
28.
echo "$y" | passwd --stdin $x
29.
chmod -R 777 $z
30.
/etc/init.d/vsftpd restart
31.
echo -e "Add user successfly ! \n your new account is $x, password is $y, your directory is $z "
32.
fi
33.
}
34.
35.
echo "Select id "
36.
echo -e "1.Install vsftpd service \n2.Add vsftpd user";
37.
read -p "Please choose id :" c
38.
case $c in 
39.
1 )
40.
install_vsftpd
41.
;;
42.
2 )
43.
add_ftpuser
44.
;;
45.
* )
46.
echo "Please choose correct"
47.
;;
48.
esac


内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://sulao.cn/post/347

评论列表