FTPD stands for (File Transfer Protocols Daemon) which is used to transfer files between computer and server. Pure-FTPD is a secure server that uses TCP protocol. It is used for personal use to transfer files. In this tutorial, we are going to set up Pure-FTPD on Centos 7 to transfer files over the FTP server.
There are other effortless ways as well to set up your Pure-FTPD server with the help of a control panel. But, in this tutorial, we are going to discuss the steps to create a Pure-FTPD server from the command line terminal on Centos 7.
Prerequisites
- Root user account/Non-root user account with Sudo privileges on your server.
- Centos 7 (You can download Putty 7.03 in case you are using Windows as an operating system. It will ask your server’s IP address and with one click you will log in from root user account).
- Installation and configuration of Openlitespeed web server, PHP and Maria DB.
- Download the latest version of FileZilla to run FTP Account.
Add Pure-FTPD Repository
Epel repository package is needed to install Pure-FTPD on centos 7:
sudo yum install epel-release
Installation of Pure-FTPD
Use the following command to install Pure-FTPD:
yum install pure-ftpd
Create MySQL (Maria DB) User and Database
Step 1) log in to Maria DB account:
mysql -u root -p
Step 2) Create Database
CREATE DATABASE pureftpd;
Step 3) Now create a database and user and grant him access to make changes:
GRANT ALL ON pureftpd.* to 'pureftpd'@'localhost' IDENTIFIED BY '_password_';
Step 4) Flush Privileges command:
FLUSH PRIVILEGES;
Step 5) Use the FTPD database and create a table for a user and quit command:
use pureftpd;
CREATE TABLE `users` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`User` varchar(32) NOT NULL DEFAULT '',
`Password` varchar(64) NOT NULL DEFAULT '',
`Uid` int(3) NOT NULL DEFAULT '500',
`Gid` int(3) NOT NULL DEFAULT '500',
`Dir` varchar(255) NOT NULL DEFAULT '',
`QuotaSize` int(4) NOT NULL DEFAULT '50',
`Status` enum('0','1') NOT NULL DEFAULT '1',
`ULBandwidth` int(2) NOT NULL DEFAULT '100',
`DLBandwidth` int(2) NOT NULL DEFAULT '100',
`Date` date NOT NULL DEFAULT '0000-00-00',
`LastModif` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`ID`),
UNIQUE KEY `User` (`User`),
KEY `Uid` (`Uid`),
KEY `Gid` (`Gid`),
KEY `Dir` (`Dir`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
exit
Configuration of Pure FTPD and Maria DB File
Step 1) Create and Configure Pure-Ftpd file using the following command:
nano /etc/pure-ftpd/pure-ftpd.conf
Step 2) We will make the following changes in Pure-Ftpd configuration file:
ChrootEveryone yes
MaxClientsNumber 50
MaxClientsPerIP 2
VerboseLog yes
AnonymousOnly no
NoAnonymous yes
MaxIdleTime 15
MySQLConfigFile /etc/pure-ftpd/pureftpd-mysql.conf
PAMAuthentication no
UnixAuthentication no
Step 3) Create and Configure Pure-Ftpd MySQL file using the following command:
nano /etc/pure-ftpd/pureftpd-mysql.conf
Step 4) Now update the following variables:
MYSQLUser pureftpd
MYSQLPassword _password_
MYSQLDatabase pureftpd
MYSQLCrypt md5
MYSQLSocket /var/lib/mysql/mysql.sock
Now, we have completed our Pure-FTPD setup.
Test Pure-FTPD Setup and Create User Account
Now we will test our Pure-FTPD set up by creating an FTP account. We need to create a user and we will use that user’s UID and GID to create our virtual FTP account.
Step 1) To create a user account:
useradd -m -d /home/wordpress faizan
Step 2) To set the password for a user account:
passwd faizan
Step 3) Now get UID and GID of this account:
cat /etc/passwd | grep faizan
Output:
The output shows that the user’s UID and GID are 1000 respectively.
Step 4) Now we are ready to create FTP account using the following command in Maria DB:
mysql -u root -p
use pureftpd;
INSERT INTO `users` (`User`, `Password`, `Uid`, `Gid`, `Dir`, `QuotaSize`,
`Status`, `ULBandwidth`, `DLBandwidth`, `Date`, `LastModif`)
VALUES ('faizan', md5('faizan'), '1000', '1000', '/home/wordpress',
'20', 2, '10', '10', now(), '');
exit
Step 5) Use “systemctl” command to restart Pure-FTPD:
systemctl restart pure-ftpd
Step 6) Now go to FileZilla and enter the following information to transfer file from your computer to server or server to computer:
- Host ( enter your server IP Address)
- Username ( In this guide, we are using exemplary username i.e. Faizan)
- Password (enter your password that you have saved while generating username)
Conclusion
Finally, we have set up Pure-FTPD on Centos 7 from the command line terminal. Other than that, you can also Install CyberPanel (web hosting control panel) with few clicks using SSH to set up the Pure-FTPD server with one click from the graphical user interface. CyberPanel comes with two variants (Free vs. Paid) but if you have a single domain then you can easily install and use CyberPanel for free to manage your site in less time. Free license of CyberPanel includes premium support, Openlitespeed web server, Pre-installed applications to set up with one click and an Incremental backup system to secure your website.