Installation of Pure-FTPD with mysql on CentOS

Pure-FTPD is free and secure FTP server that doesn’t offer unless bells and whistles. However it focuses on potency and simple use. It provides easy answers to common wants, and distinctive helpful features for personal users and hosting suppliers. We are going to discuss the setup of pure-FTPD with mysql on centos by using following steps.

Steps :

Step 1 : Install mysql and mysql-server

Step 2 : Install Pure-FTPD

Step 3 : Create mysql User and Database

Step 4 : Configure Pure-FTPD.

Step 5 : Test Pure-FTPD setup

Let us see the steps in Details :

Step 1 : Install mysql and mysql-server

[root@experts ~]# yum install mysql mysql-server

Step 2 : Install Pure-FTPD

[root@experts ~]# yum install pure-ftpd

Step 3 : Create mysql User and Database

[root@experts ~]# mysql -u root -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 5

Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> CREATE DATABASE pureftpd;

Query OK, 1 row affected (0.00 sec)

mysql> GRANT ALL ON pureftpd.* to ‘pureftpd’@'localhost’ IDENTIFIED BY ‘pass123′;

Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;

Query OK, 0 rows affected (0.00 sec)

mysql> use pureftpd;

Database changed

mysql> 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;

Query OK, 0 rows affected (0.05 sec)

mysql > quit

Step 4 : Configure Pure-FTPD.

4.1  Edit (/etc/pure-ftpd/pure-ftpd.conf)  and make some following changes.

[root@experts ~]# vi  /etc/pure-ftpd/pure-ftpd.conf

ChrootEveryone              yes

MaxClientsNumber            50

MaxClientsPerIP             8

VerboseLog                  yes

AnonymousOnly                no

NoAnonymous                   yes

MaxIdleTime                   15

MySQLConfigFile             /etc/pure-ftpd/pureftpd-mysql.conf

PAMAuthentication           no

UnixAuthentication          no

4.2  Edit ( /etc/pure-ftpd/pureftpd-mysql.conf)  and make following changes.

[root@experts ~]#  vi /etc/pure-ftpd/pureftpd-mysql.conf

MYSQLUser          pureftpd

MYSQLPassword      pass123

MYSQLDatabase      pureftpd

MYSQLCrypt         md5

Step 5 : Test Pure-FTPD setup

To test we need to create one ftp account. To test our setup, first we need to create an user in linux system. After that we will use that users UID and GID to create our virtual ftp accounts.

5.1  Create user account with the help of following commands:

[root@experts ~]# useradd demouser1

[root@experts ~]# passwd demouser1

5.2  Get UID and GID of this Account.

[root@experts ~]# cat /etc/passwd | grep demouser1

demouser1:x:508:508::/home/user2:/bin/bash

Note : As per above output we found that user’s UID is 508 and GID is 508.

5.3  Create FTP account.

Lets login to mysql server and create your first account.

[root@experts ~]# mysql –u root –p

Enter password:

mysql>use pureftpd;

mysql> INSERT INTO `users` (`User`, `Password`, `Uid`, `Gid`, `Dir`, `QuotaSize`,`Status`, `ULBandwidth`, `DLBandwidth`, `Date`, `LastModif`)

VALUES (‘ftpuser1′, md5(‘_password_’), ’508′, ’508′, ‘/home/demouser1′,’20′, 2, ’10′, ’10′, now(), ”);

Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> quit

5.4  Connect to FTP Server using newly created ftp account

Open command prompt and use the following command.

C:/> ftp 192.168.0.10

Thanks for watching.

Both comments and pings are currently closed.

Comments are closed.

Copyright ©Solutions@Experts.com
Copyright © NewWpThemes Techmark Solutions - www.techmarksolutions.co.uk