1. download and install the software
[root@chenghy ~]# cd /root[root@chenghy ~]# wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.4c.tar.gz[root@chenghy ~]# tar zxvf proftpd-1.3.4c.tar.gz[root@chenghy ~]# cd proftpd-1.3.4c[root@chenghy ~]# ./configure --prefix=/usr/local/proftpd[root@chenghy ~]# make[root@chenghy ~]# make install
2. modify the configuration file
[Root @ chenghy ~] # Vim/usr/local/proftpd/etc/proftpd. confServerName "chenghy's FTP Server" ServerType standalone # Run DefaultServer onPort 21 # FTP port Umask 002 # permission as an independent process, recommended to 002 UseReverseDNS off # disable DNS reverse lookup IdentLookups off # disable DNS reverse lookup ServerIdent off # Hide software version information AllowRetrieveRestart on # download resumable upload AllowStoreRestart on # upload resumable upload # virtual user authentication information AuthOrder mod_auth_file.c # only virtual users are allowed to log on to AuthUserFile/usr/local/proftpd/etc/ftp. usersAuthGro UpFile/usr/local/proftpd/etc/ftp. groupDefaultRoot ~ # Restrict the user to the root directory PassivePorts 20000 30000 # passive mode port segment SystemLog/var/log/proftpd. log # software log TransferLog/var/log/proftpd. xfer. logLogFormat default "% h % u % t % D \" % r \ "% s % B" # log format ExtendedLog/var/log/proftpd/access. log WRITE, READ default # access log MaxInstances 250 # allow maximum connection to MaxClients 20 # maximum number of users MaxLoginAttempts 3 # maximum number of attempted connections TimeoutLogin 30 # authentication timeout TimeoutIdle 120 # daze timeout TimeoutNoTransfer 300 # No data Transmission timeout User nobody # define the User identity in which ftp runs Group nobody # define the User Group identity in which ftp runs <Directory ~ /> AllowOverwrite on # allow write override <Limit login cwd retr read dirs> # Set the virtual user's READ permission AllowALL </Limit> <Limit ALL> # Set the omd user's ALL permissions Order allow, deny AllowUser omd DenyALL </Limit> </Directory>
3. Add virtual users and groups
[root@chenghy ~]# /usr/local/proftpd/bin/ftpasswd --passwd --name=bsmp --home=/home/omd/file/ --uid=2001 --gid=2000 --shell=/sbin/nologin --file=/usr/local/proftpd/etc/ftp.users[root@chenghy ~]# /usr/local/proftpd/bin/ftpasswd --passwd --name=omd --home=/home/omd/ --uid=2002 --gid=2000 --shell=/sbin/nologin --file=/usr/local/proftpd/etc/ftp.users[root@chenghy ~]# /usr/local/proftpd/bin/ftpasswd --group --name=myftp --gid=2000 --member=bsmp --member=omd --file=/usr/local/proftpd/etc/ftp.group
4. Set User Directory Permissions
[root@chenghy ~]# chown -R 2002:2000 /home/omd/
#### The following two rows are used to delete users and groups ###########
[root@chenghy ~]# /usr/local/proftpd/bin/ftpasswd --passwd --name=bsmp --delete-user --file=/usr/local/proftpd/etc/ftp.users[root@chenghy ~]# /usr/local/proftpd/bin/ftpasswd --group --name=myftp --delete-group --file=/usr/local/proftpd/etc/ftp.group
5. Add proftpd to System Service
After modifying the/etc/rc. d/init. d/proftpd file according to the information on the Internet, I found that the configuration was unsuccessful. Then I modified the file and completed the configuration.
[Root @ chenghy ~] # Vim/etc/rc. d/init. d/proftpd #! /Bin/sh # Source function library .. /etc/rc. d/init. d/functionsRETVAL = 0 start () {echo-n $ "Starting proftpd: "daemon/usr/local/proftpd/sbin/proftpd-c/usr/local/proftpd/etc/proftpd. conf 2>/dev/null # The daemon command is/etc/rc. d/init. d/RETVAL in functions =$? Echo [$ RETVAL-eq 0] & touch/var/lock/subsys/proftpd} stop () {echo-n $ "Shutting down proftpd: "killproc proftpd # The killproc command is/etc/rc. d/init. d/RETVAL in functions =$? Echo [$ RETVAL-eq 0] & rm-f/var/lock/subsys/proftpd} # See how we were called. case "$1" in start) start; stop) stop; restart) stop start; *) echo "Usage: proftpd {start | stop | restart} "esac [root @ chenghy ~] # Chmod 755/etc/rc. d/init. d/proftpd [root @ chenghy ~] # Chkconfig add proftpd [root @ chenghy ~] # Chkconfig -- level 35 proftpd on [root @ chenghy ~] # Service proftpd start
6. Firewall settings
Only the following items ① and ② can be added for access in active mode, and only the following ② and ③ can be added for access in passive mode, the following items can be added in both modes: ①, ②, and ③.
[root@chenghy ~]# iptables -A RH-Firewall-1-INPUT -p tcp -m tcp --dport 20 -j ACCEPT[root@chenghy ~]# iptables -A RH-Firewall-1-INPUT -p tcp -m tcp --dport 21 -j ACCEPT[root@chenghy ~]# iptables -A RH-Firewall-1-INPUT -p tcp -m tcp --dport 20000:30000 -j ACCEPT