Publish: 2019-08-22 | Modify: 2019-08-22
PureFTPd is a free FTP server software (based on the BSD License) that focuses on program robustness and software security. Currently, common one-click installation packages such as Oneinstack, lnmp.org, and baota have integrated PureFTPd services, indicating that PureFTPd is a very popular FTP service software.
Sometimes we don't need too much integrated environment, just want to use FTP service simply and easily. You can try to configure Pure-ftpd on your own and share the method of installing and configuring Pure-ftpd on CentOS 7.
# Install epel source
yum -y install epel-release
# Install pure-ftpd
yum -y install pure-ftpd
The default configuration file of Pure-ftpd is located at /etc/pure-ftpd/pure-ftpd.conf
, and the commonly used configurations are as follows:
# Specify the path of PureDB user database file
PureDB /etc/pure-ftpd/pureftpd.pdb
# Enable logging
VerboseLog yes
# Disallow anonymous login
NoAnonymous yes
# Use passive mode and set the port range
PassivePortRange 30000 50000
The purpose of creating system users is mainly to let the FTP directory inherit the user's permissions. The following commands add a www
user and a www
user group. Please create the user and user group according to the actual situation.
# Create www user group
groupadd www
# Create a www user
useradd -g www -s /sbin/nologin -d /dev/null www
Next, create FTP virtual users, which are often used FTP accounts:
# Create a new FTP directory
mkdir -p /data/wwwroot/ftp
# Set directory permissions
chown -R www:www /data/wwwroot/ftp
# Create an FTP user xiaoz
pure-pw useradd xiaoz -u www -d /data/wwwroot/ftp -m
Let me explain the function of the line pure-pw useradd xiaoz -u www -d /data/wwwroot/ftp -m
:
pure-pw useradd xiaoz
: Add an FTP user xiaoz
-u www
: Specify the system user as www-d /data/wwwroot/ftp
: Specify the FTP path-m
: Write user information to the pureftpd.pdb databaseFTP uses port 21 by default, and we have also configured the passive ports (30000-50000), so you need to open these ports in the firewall or security group. The following is the method of opening ports in firewalld. If you are using iptables, please refer to: iptables firewall, common rules summary
# Open port 21
firewall-cmd --zone=public --add-port=21/tcp --permanent
# Open port range 30000-50000
firewall-cmd --zone=public --add-port=30000-50000/tcp --permanent
# Reload firewalld
firewall-cmd --reload
To start Pure-ftpd, simply execute the command systemctl start pure-ftpd
. Some commonly used commands are as follows.
# Start pure-ftpd
systemctl start pure-ftpd
# Set to start on boot
systemctl enable pure-ftpd
# Stop pure-ftpd
systemctl stop pure-ftpd
# Disable starting on boot
systemctl disable pure-ftpd
If you need to get the usage of pure-ftpd, you can enter pure-pw -h
to view the help.
Enter the command netstat -apn|grep 'pure-ftpd'
to check whether Pure-ftpd is listening normally. If it is listening successfully, you can use an FTP client (such as Filezilla) to connect and ensure that the upload and download are normal.
ImgURL Pro Professional Edition, developed by Xiaoz, supports FTP upload of images. If needed, you can visit: https://blog.xiaoz.org/archives/13225 to view it. Currently, it is on sale with a 60% discount.
Some content in this article refers to: CentOS7 YUM Install Pure-ftpd
I come from China and I am a freelancer. I specialize in Linux operations, PHP, Golang, and front-end development. I have developed open-source projects such as Zdir, ImgURL, CCAA, and OneNav.