1. YUM Installation (Default Version 1.0.30-1.el6)
CentOS 6 64-bit EPEL Installation:
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
CentOS 7 EPEL Installation:
rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
yum install pure-ftpd -y
2. Configuration
vim /etc/pure-ftpd/pure-ftpd.conf
PureDB /etc/pure-ftpd/pureftpd.pdb # Uncomment this line; it stores FTP login user and password information
VerboseLog yes # Change to yes
MaxClientsPerIP 8 # Default is 8, change to 48 or another number
NoAnonymous yes # Change to yes to deny anonymous logins
PassivePortRange 30000 50000 # Uncomment this line to use passive mode and restrict ports.
AltLog clf:/var/log/pureftpd.log # Uncomment this line
AltLog w3c:/var/log/pureftpd.log # Uncomment this line
FortunesFile /usr/share/fortune/zippy
Change to
FortunesFile /etc/pure-ftpd/welcome.conf
vi /etc/pure-ftpd/welcome.conf
Enter the following:
———- Welcome to my files server ———-
Create Account and Configure Permissions
groupadd www
useradd -g www -s /sbin/nologin -d /dev/null www
Create Virtual Account
mkdir /data/ftp -p # Create FTP directory
pure-pw useradd by365 -d /data/ftp/ -u www -m # Change the username as needed
Configure Directory Permissions
chown www.www /data/ftp/ -R
Add to Firewall Allowlist:
/sbin/iptables -I INPUT -p tcp –dport 21 -j ACCEPT
/sbin/iptables -I INPUT -p tcp –dport 30000:50000 -j ACCEPT
/etc/rc.d/init.d/iptables save
service iptables restart
service pure-ftpd start # Start the service
Start on Boot:
chkconfig pure-ftpd –level 345 on
Start and Stop Operations:
service pure-ftpd stop
service pure-ftpd start
service pure-ftpd status
Other Common Operations:
Add a New User
mkdir /data/ftp2 # Create FTP directory
pure-pw useradd user2 -d /data/ftp2/ -u ftpuser -m # Here user2 is the example username, the FTP user directory is /data/ftp2/, and ftpuser is the system group. Change these as needed.
chown ftpuser.ftpgroup /data/ftp2/ -R # Note: All FTP users uniformly use the system user and group ftpuser and ftpgroup for authorization. Users are not saved to system users, but to the file /etc/pure-ftpd/pureftpd.pdb defined in the software configuration file.
Query Users and Their Directories:
pure-pw list
Delete a User:
pure-pw userdel ftpuser1