PURE-FTPD Write an auto-install script shell

Source: Internet
Author: User

After running the script, enter Yes to install automatically

#!/bin/bashport= ' Netstat -lnp|grep :21|wc -l ' Check_ok () {         if [ $? -eq 0 ];then        echo   "Check ok" elseecho  "check error "  && exit          fi}read -p  "auto install ftp input  ' yes '   install on:      "  yesif [  yes == " $yes "  -a  $port  == 0 ];then# Gets the current IP address, the default first IP address ip= ' ifconfig|awk -f [:a-z " "]+   ' nr==2 {print $2} ' lftp= "Yum install -y lftp" user=ftptestpure1= Pure-ftpd-1.0.42.tar.bz2pure=pure-ftpd-1.0.42url= "http://download.pureftpd.org/pub/pure-ftpd/releases/$pure 1  --no-check-certificate "src=/tmp/ftp# randomly get 5 digital ciphers passwd=$ ((random)) echo  -e " \033[33m - -----------------------------------------------------\033[0m "echo  -e " \033[33m -                                                       -\033[0m "echo  -e " \033[33m -                                                       -\033[0m "echo  - e  "\033[33m -                                      &nBsp;               -\033[0m "Echo   -e  "\033[33m -                       Auto install FTP               -\033[0m "echo  -e " \033[33m -                                                       -\033[0m "Echo   -e  "\033[33m -                                    &Nbsp;                 -\ 033[0m "echo  -e " \033[33m -                                                       -\033[0m "echo  -e " \033[33m -------------------------- ----------------------------\033[0m "sleep 2cd /usr/local/src/rm -rf  $pure  &&  rm -rf  $pure 1wget  $URLcheck _oktar -jxvf  $pure 1&NBSP;&NBSP;&AMP;&AMP;&NBSP;CD   $pure # to initialize./configure --prefix=/usr/local/pureftpd --without-inetd --with-altlog -- with-puredb --with-throttling --with-peruserlimits  --with-tlsacheck_ok make  && make installmkdir -p /usr/local/pureftpd/etc/ && cd configuration-file/cp  pure-ftpd.conf /usr/local/pureftpd/etc/pure-ftpd.confcp pure-config.pl  /usr/local/ pureftpd/sbin/chmod 755 /usr/local/pureftpd/sbin/pure-config.plcheck_ok# emptying the configuration file   writing new configuration >  /usr/local/pureftpd/etc/pure-ftpd.confecho  "hrooteveryone               yesBrokenClientsCompatibility  noMaxClientsNumber             50Daemonize                    yesMaxClientsPerIP              8VerboseLog                   noDisplayDotFiles              yesanonymousonly                noNoAnonymous                  noSyslogFacility               ftpDontResolve                  yesMaxIdleTime                  15PureDB                       /usr/local/pureftpd/etc/pureftpd.pdb   #这是一个用户名和密码库LimitRecursion                3136 8AnonymousCanCreateDirs      noMaxLoad                      4antiwarez                    yesUmask                         133:022MinUID                       100       #你不能映射uid   Less than 100  minimum of 100    limit 100allowuserfxp                 noAllowAnonymousFXP            noprohibitdotfileswrite       noprohibitdotfilesread         noAutoRename                   noanonymouscantupload          nopidfile                      /usr/local/pureftpd/var/run/pure-ftpd.pidMaxDiskUsage                99CustomerProof               yes "  > /usr/local/pureftpd/etc/ pure-ftpd.confcheck_okmkdir  $srcuseradd   $user  -s /sbin/nologin -mchown -r $ user  $src/usr/local/pureftpd/bin/pure-pw useradd ftpuser -u$user -d  $src   <<eof$passwd$passwdeofcheck_ok/usr/local/pureftpd/bin/pure-pw mkdb /usr/local/pureftpd/sbin/ pure-config.pl /usr/local/pureftpd/etc/pure-ftpd.conf check_okrm -rf /usr/local/src/$ pure1rm -rf /usr/local/src/$pure $lftpecho  -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[5;33m -          auto install ftp         Yes                -\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 2echo -e " USER:FTPUSER&NBSP;PASSWD: $passwd \nuse: lftp [email  Protected] $ip \ndir:  $src \naccount and passwd to the root dir ftp.txt "# Save the account and password to the home directory, which is the root directory echo  "user:ftpuser2\npasswd: $passwd"  > ~/ftp.txtelseecho  "Cancel  install,check p Ort 21\n exit " &&exitfi 


1. Delete the FTP user command [[email protected] CONFIGURATION-FILE]#/USR/LOCAL/PUREFTPD/BIN/PURE-PW Userdel ftpuser1 2. Modify FTP user password [[email protected] ~]#/USR/LOCAL/PUREFTPD/BIN/PURE-PW passwd ftpuser[[email protected] ~]#/usr/local/ PUREFTPD/BIN/PURE-PW MKDB//Perform the above change password to update the password vault


After installation, the account number and password will be entered on the screen and stored in the home directory Ftp.txt file

PURE-FTPD Write an auto-install script shell

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.