运行脚本后 输入 yes 就会自动安装

#!/bin/bash
port=`netstat -lnp|grep :21|wc -l`
check_ok()
{
        if [ $? -eq 0 ];then
        echo "check ok"
else
echo "check error " && exit 
        fi
}
read -p "AUto install ftp input 'yes' install on:     "  yes
if [  yes == "$yes" -a $port == 0 ];then
#获取当前ip地址,默认第一个ip地址
ip=`ifconfig|awk -F [" ":]+ 'NR==2 {print $4}'`
lftp="yum install -y lftp"
user=ftptest
pure1=pure-ftpd-1.0.43.tar.bz2
pure=pure-ftpd-1.0.43
URL="https://download.pureftpd.org/pub/pure-ftpd/releases/obsolete/$pure1 --no-check-certificate"
src=/tmp/ftp
#随机获取15个混合密码
passwd=$(date +%s | md5sum|head -c 15)
echo  -e "\033[33m ------------------------------------------------------\033[0m"
echo  -e "\033[33m -                                                    -\033[0m"
echo  -e "\033[33m -                                                    -\033[0m"
echo  -e "\033[33m -                                                    -\033[0m"
echo  -e "\033[33m -                      Auto install FTP              -\033[0m"
echo  -e "\033[33m -                                                    -\033[0m"
echo  -e "\033[33m -                                                    -\033[0m"
echo  -e "\033[33m -                                                    -\033[0m"
echo  -e "\033[33m ------------------------------------------------------\033[0m"
sleep 2
cd /usr/local/src/
rm -rf $pure && rm -rf $pure1
wget $URL
check_ok
tar -jxvf $pure1  && cd $pure
#进行初始化
./configure \
--prefix=/usr/local/pureftpd \
--without-inetd \
--with-altlog \
--with-puredb \
--with-throttling \
--with-peruserlimits  \
--with-tlsa
check_ok 
make && make install
mkdir -p /usr/local/pureftpd/etc/ && cd configuration-file/
cp pure-ftpd.conf /usr/local/pureftpd/etc/pure-ftpd.conf
cp pure-config.pl  /usr/local/pureftpd/sbin/
chmod 755 /usr/local/pureftpd/sbin/pure-config.pl
check_ok
#清空配置文件 写入新的配置
> /usr/local/pureftpd/etc/pure-ftpd.conf
echo "hrootEveryone              yes
BrokenClientsCompatibility  no
MaxClientsNumber            50
Daemonize                   yes
MaxClientsPerIP             8
VerboseLog                  no
DisplayDotFiles             yes
AnonymousOnly               no
NoAnonymous                 no
SyslogFacility              ftp
DontResolve                 yes
MaxIdleTime                 15
PureDB                      /usr/local/pureftpd/etc/pureftpd.pdb 
#这是一个用户名和密码库
LimitRecursion              3136 8
AnonymousCanCreateDirs      no
MaxLoad                     4
AntiWarez                   yes
Umask                       133:022
MinUID                      100      
#你不能映射uid 小于100 最小100的  限制100
AllowUserFXP                no
AllowAnonymousFXP           no
ProhibitDotFilesWrite       no
ProhibitDotFilesRead        no
AutoRename                  no
AnonymousCantUpload         no
PIDFile                     /usr/local/pureftpd/var/run/pure-ftpd.pid
MaxDiskUsage               99
CustomerProof              yes"  > /usr/local/pureftpd/etc/pure-ftpd.conf
check_ok
mkdir $src
useradd $user -s /sbin/nologin -M
chown -R $user $src
/usr/local/pureftpd/bin/pure-pw useradd ftpuser -u$user -d $src < ~/ftp.txt
else
echo "cancel install,check port 21\n exit" &&exit
fi


1. 删除ftp用户命令
[root@ftp configuration-file]#/usr/local/pureftpd/bin/pure-pw userdel ftpuser  
2. 修改ftp用户密码
[root@ftp ~]# /usr/local/pureftpd/bin/pure-pw passwd ftpuser
[root@ftp ~]# /usr/local/pureftpd/bin/pure-pw mkdb   //执行上面的修改密码后 需要更新一下密码库


安装完后会把账号和密码输入到屏幕上,存到主目录下ftp.txt文件