centos6一键安装vsftpd脚本

手动安装vsftpd参考教程:Centos下安装Vsftpd的图文教程

vsftpd脚本功能:

1.安装 (命令执行:sh xxx.sh)2.添加ftp用户 (命令执行:sh xxx.sh add)3.卸载vsftpd (命令执行:sh xxx.sh uninstall)

测试环境:centos6 x64 centos6 x86(测试centos7以上无法安装)

vsftpd shell脚本代码:

#!/bin/bash
Stack=$1
if [ "${Stack}" = "" ]; thenStack="install"
elseStack=$1
fi
install_vsftp()
{echo "#######################"echo -e "\033[33mUsage: $0 {install|add|uninstall}\033[0m"echo -e "\033[33msh $0 (default:install)\033[0m"echo -e "\033[33msh $0 add (Add FTP user)\033[0m"echo -e "\033[33msh $0 uninstall (Uninstall FTP)\033[0m"echo "#######################"A=`head -c 500 /dev/urandom | tr -dc a-zA-Z | tr [a-z] [A-Z]|head -c 1`B=`head -c 500 /dev/urandom | tr -dc a-z0-9A-Z | head -c 6`C=`echo $RANDOM|cut -c 2`rpm -q vsftpdif [ "$?" -eq "0" ]; thenecho "You have to install VSFTPD!"elsenetstat -ntulp |grep -w 21if [ "$?" -eq "0" ]; thenecho "Other FTP is already installed"elseread -p "The FTP access directory(default:/home): " directoryif [ "${directory}" != "" ]; thendirectorys="${directory}"elsedirectorys="/home"firead -p "Please enter the FTP user: " ftp_userread -p "Enter the FTP password(default:$A$B$C): " ftp_passif [ "${ftp_pass}" != "" ]; thenftp_passa="${ftp_pass}"elseftp_passa="$A$B$C"fiyum -y install vsftpdif [ "$?" -eq "0" ]; thenif [ -d ${directorys} ]; thenchmod -R 777 ${directorys}fiuseradd -d ${directorys} -g ftp -s /sbin/nologin ${ftp_user}echo "${ftp_passa}" | passwd --stdin ${ftp_user} > /dev/nullsed -i 's/^anonymous_enable=YES/anonymous_enable=NO/g' /etc/vsftpd/vsftpd.confsed -i 's/^#chroot_local_user=YES/chroot_local_user=YES/g' /etc/vsftpd/vsftpd.confsed -i 's/^#chroot_list_enable=YES/chroot_list_enable=YES/g' /etc/vsftpd/vsftpd.confecho "userdel ${ftp_user}" >> /etc/vsftpd/user_list.shecho "" > /etc/vsftpd/chroot_listchkconfig vsftpd onservice vsftpd restartecho "###################################"echo "FTP user:${ftp_user}"echo "Ftp password:${ftp_passa}"echo "The FTP directory:${directorys}"echo "-----------------------------------"elseecho "VSFTPD installation failed!"fififi
}
add_ftp()
{A=`head -c 500 /dev/urandom | tr -dc a-zA-Z | tr [a-z] [A-Z]|head -c 1`B=`head -c 500 /dev/urandom | tr -dc a-z0-9A-Z | head -c 6`C=`echo $RANDOM|cut -c 2`read -p "The FTP access directory(Such as:/home): " directoryif [ "${directory}" != "" ]; thendirectorys="${directory}"elsedirectorys="/home"firead -p "Please enter the FTP user: " ftp_userread -p "Enter the FTP password(default:$A$B$C): " ftp_passif [ -d ${directorys} ]; thenchmod -R 777 ${directorys}fiuseradd -d ${directorys} -g ftp -s /sbin/nologin ${ftp_user}if [ "${ftp_pass}" != "" ]; thenftp_passa="${ftp_pass}"elseftp_passa="$A$B$C"fiecho "${ftp_passa}" | passwd --stdin ${ftp_user} > /dev/nullecho "userdel ${ftp_user}" >> /etc/vsftpd/user_list.shif [ -d ${directorys} ]; thenchmod -R 777 ${directorys}fiecho "###################################"echo "FTP user:${ftp_user}"echo "Ftp password:${ftp_passa}"echo "The FTP directory:${directorys}"echo "-----------------------------------"}
uninstall_ftp()
{
yum -y remove vsftpd*
sh /etc/vsftpd/user_list.sh
echo "" > /etc/vsftpd/user_list.sh
}
case "${Stack}" ininstall)install_vsftp;;add)add_ftp;;uninstall)uninstall_ftp;;*)echo "Usage: $0 {install|add|uninstall}";;
esac

centos6一键安装vsftpd脚本下载:

wget http://www.tieww.com/soft/vsftp_root.sh && sh vsftp_root.sh

centos6一键安装vsftpd脚本相关推荐

  1. 【Linux】Aria2 一键安装管理脚本 BT\PT一键安装包

    项目地址 https://github.com/P3TERX/aria2.sh 系统要求 CentOS 6+ / Debian 6+ / Ubuntu 14.04+ 下载安装 执行下面的代码下载并运行 ...

  2. Centos Denyhosts 一键安装配置脚本

    Centos Denyhosts 一键安装配置脚本 一键安装denyhosts脚本并配置为常用配置.放置Linux服务器被暴力破解 由于不能上传tar文件.所以改为zip压缩. 将附件的zip压缩包解 ...

  3. s14.一键安装haproxy脚本

    一键安装haproxy脚本 root@ubuntu1804:~# cat install_haproxy.sh #!/bin/bash # #***************************** ...

  4. s15.一键安装java脚本

    一键安装java脚本 #安装java8 root@ubuntu1804:~# cat install_jdk_8.sh #!/bin/bash # #************************* ...

  5. 一键安装lamp脚本--初级版

    #!/bin/bash #write by zhang_pc #at 2015.07.21 #apache2.2.27 mysql5.1 php5.4 #安装说明,由于网速原因,就不下载了,执行脚本前 ...

  6. linux一键安装rdp脚本,linux使用一键安装远程桌面环境/RDP脚本遇到问题与解决

    老左前几天有在"Linux 系统一键安装远程桌面环境/RDP 支持CentOS/Debian/Ubuntu"文章中介绍到网友分享的一键安装桌面环境的方法,当时这篇文章的测试服务器是 ...

  7. 一键安装LAMP脚本

    一键安装LAMP架构 #!/bin/bash #auto install LAMP #by 2017-10-11 #auto lijunmin#Httpd define path variable(定 ...

  8. 一键安装lnmp脚本(包括软件版本)

    直接上脚本:附件也包含脚本 #!/bin/bash yum -y install make apr* autoconf automake curl-devel gcc gcc-c++ zlib-dev ...

  9. LNMP一键安装shell脚本

    前段时间维护服务器,需要安装LNMP环境,所以就整理了一下,做为脚本,记录下来. #!/bin/sh #Copyright(c) 2010-2015 redapple (16325975@qq.com ...

最新文章

  1. android 判断有线耳机、蓝牙耳机连接
  2. python语法基础知识-python基础知识---简单语法
  3. 题解西电OJ (Problem 1008 - 数星星)
  4. 【转】Windows服务调试技巧
  5. LeetCode 143. 重排链表(链表反转+快慢指针)
  6. 03-谷歌浏览器安装Sence
  7. npu算力如何计算_华为云郑叶来:多元算力驱动应用创新
  8. mysql导入表error 1067_mysql 导入数据error 1067(42000) Invalid default value for 'update'
  9. 想要挡住对向来车的远光灯,能否把公路中间的隔离墙垒高点来阻挡?
  10. wordpress学习(四)---url伪静态简单了解
  11. select机制的原理
  12. 06-移位寄存器74HC595芯片编程
  13. 扩展卡尔曼滤波EKF
  14. 微信小程序体验版无法调用接口
  15. 【云原生】—— 学习云计算应用开发你需要掌握的五大技能
  16. 如何用纯 CSS 创作一只愤怒小鸟中的绿猪
  17. 笔记本AutoCAD启动时闪退怎么办_AutoCAD启动时闪退怎么办?打开AutoCAD闪退怎么办?...
  18. Shopee末端物流智能提效之路
  19. Pycharm远程访问ssh,远程访问服务器(xshell访问服务器)
  20. 外贸软件之冷冻食品进口贸易管理系统

热门文章

  1. OpenCV 笔记(04)— OpenCV2 升级到 OpenCV3/CV4 的改动(去掉 CV_前缀、使用新的前缀替换、使用新的命名空间宏)
  2. 一段神奇的c代码错误分析
  3. tensor转换 pytorch tensorflow
  4. GPT3后可考虑的方向-知识推理与决策任务及多模态的信息处理
  5. pytorch: Variable detach 与 detach_
  6. SLAM图优化g2o
  7. Octave Convolution卷积
  8. Hashing散列注意事项
  9. Android广播监听usb插拔状态
  10. [JS] undefined、null、ReferenceError的区别、变量作用域问题