pure-ftpd

---------

https://pure-ftpd-webui.org/wiki/Pure-FTPd%2BMySQL%20installation#CentOS

https://pure-ftpd-webui.org/wiki/Pure-FTPd%20WebUI%20installation

https://www.howtoforge.com/tutorial/pure-ftpd-virtual-ftp-server-centos-7-2/

https://www.simplehelix.com/blog/uncategorized/installing-and-configuring-pure-ftpd-on-centos-7/

Pure-FTPd+MySQL installation

TOC?

Ubuntu.

Pure-ftpd and mysql installation.

Install  pure-ftpd and  mysql:

root@server:~# apt-get install pure-ftpd pure-ftpd-common pure-ftpd-mysql mysql mysql-common mysql-server php5 php5-mysql apache2

Create group (_ftpgroup_) and user (_ftpuser_) to associate with pure-ftpd users:

root@server:~# groupadd -g 2001 ftpgroup root@server:~# useradd -u 2001 -s /bin/false -d /bin/null -c "pureftpd user" -g ftpgroup ftpuser

Create pure-ftpd configuration file.

Pure-ftpd configuration file:

root@server:~# echo " ############################################################ #                                                          # #         Configuration file for pure-ftpd wrappers        # #                                                          # ############################################################  ChrootEveryone              yes BrokenClientsCompatibility  no MaxClientsNumber            50 Daemonize                   yes MaxClientsPerIP             8 VerboseLog                  yes DisplayDotFiles             no AnonymousOnly               no NoAnonymous                 yes SyslogFacility              ftp FortunesFile              /etc/pure-ftpd/cookie DontResolve                 yes MaxIdleTime                 15 # LDAPConfigFile                /etc/pureftpd-ldap.conf MySQLConfigFile               /etc/pure-ftpd/mysql.conf # PGSQLConfigFile               /etc/pureftpd-pgsql.conf # PureDB                        /etc/pureftpd.pdb # ExtAuth                       /var/run/ftpd.sock # PAMAuthentication             yes # UnixAuthentication            yes LimitRecursion              10000 8 AnonymousCanCreateDirs      no # MaxLoad                     4 # PassivePortRange          30000 50000 # ForcePassiveIP                192.168.0.1 # AnonymousRatio                1 10 # UserRatio                 1 10 AntiWarez                   yes # Bind                      127.0.0.1,21 # AnonymousBandwidth            8 # UserBandwidth             8 Umask                       133:022 # MinUID                      2001 AllowUserFXP                no AllowAnonymousFXP           no ProhibitDotFilesWrite       no ProhibitDotFilesRead        no AutoRename                  no AnonymousCantUpload         no # TrustedIP                  10.1.1.1 # LogPID                     yes # AltLog                     clf:/var/log/pureftpd.log # AltLog                     stats:/var/log/pureftpd.log # AltLog                     w3c:/var/log/pureftpd.log NoChmod                     yes KeepAllFiles                yes CreateHomeDir               yes # Quota                       1000:10 PIDFile                     /var/run/pure-ftpd.pid # CallUploadScript yes # MaxDiskUsage               99 # NoRename                  yes CustomerProof              yes # PerUserLimits            3:20 # NoTruncate               yes # TLS                      1 IPV4Only                 yes # IPV6Only                 yes FileSystemCharset       utf8 ClientCharset           cp1251" > /etc/pure-ftpd/pure-ftpd.conf

Create mysql configuration file for pure-ftpd.

MySQL configuration file for  pure-ftpd:

root@server:~# echo " MYSQLSocket      /var/run/mysqld/mysqld.sock #MYSQLServer     localhost #MYSQLPort       3306 MYSQLUser       pureftpd MYSQLPassword   pureftpdpass MYSQLDatabase   pureftpd #MYSQLCrypt md5, cleartext, crypt() or password() - md5 is VERY RECOMMENDABLE uppon cleartext MYSQLCrypt      md5 MYSQLGetPW      SELECT Password FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") MYSQLGetUID     SELECT Uid FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") MYSQLGetGID     SELECT Gid FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") MYSQLGetDir     SELECT Dir FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") MySQLGetBandwidthUL SELECT ULBandwidth FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") MySQLGetBandwidthDL SELECT DLBandwidth FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") MySQLGetQTASZ   SELECT QuotaSize FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") MySQLGetQTAFS   SELECT QuotaFiles FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")" > /etc/pure-ftpd/mysql.conf

Start apache server:

root@server:~# /etc/init.d/apache2 start

Start mysql server:

root@server:~# /etc/init.d/mysql start

Restart pure-ftpd daemon:

root@server:~# /etc/init.d/pure-ftpd restart

Now you can start Pure-FTPd WebUI installation.

CentOS.

Pure-ftpd and mysql installation.

Install  pure-ftpd and  mysql:

root@server:~# yum install pure-ftpd mysql mysql-server httpd php php-mysql php-mbstring

Create group (_ftpgroup_) and user (_ftpuser_) to associate with pure-ftpd users:

root@server:~# groupadd -g 2001 ftpgroup root@server:~# useradd -u 2001 -s /bin/false -d /bin/null -c "pureftpd user" -g ftpgroup ftpuser

Create pure-ftpd configuration file.

Pure-ftpd configuration file:

root@server:~# echo " ############################################################ #                                                          # #         Configuration file for pure-ftpd wrappers        # #                                                          # ############################################################  ChrootEveryone              yes BrokenClientsCompatibility  no MaxClientsNumber            50 Daemonize                   yes MaxClientsPerIP             8 VerboseLog                  yes DisplayDotFiles             no AnonymousOnly               no NoAnonymous                 yes SyslogFacility              ftp FortunesFile              /etc/pure-ftpd/cookie DontResolve                 yes MaxIdleTime                 15 # LDAPConfigFile                /etc/pureftpd-ldap.conf MySQLConfigFile               /etc/pure-ftpd/mysql.conf # PGSQLConfigFile               /etc/pureftpd-pgsql.conf # PureDB                        /etc/pureftpd.pdb # ExtAuth                       /var/run/ftpd.sock # PAMAuthentication             yes # UnixAuthentication            yes LimitRecursion              10000 8 AnonymousCanCreateDirs      no # MaxLoad                     4 # PassivePortRange          30000 50000 # ForcePassiveIP                192.168.0.1 # AnonymousRatio                1 10 # UserRatio                 1 10 AntiWarez                   yes # Bind                      127.0.0.1,21 # AnonymousBandwidth            8 # UserBandwidth             8 Umask                       133:022 # MinUID                      2001 AllowUserFXP                no AllowAnonymousFXP           no ProhibitDotFilesWrite       no ProhibitDotFilesRead        no AutoRename                  no AnonymousCantUpload         no # TrustedIP                  10.1.1.1 # LogPID                     yes # AltLog                     clf:/var/log/pureftpd.log # AltLog                     stats:/var/log/pureftpd.log # AltLog                     w3c:/var/log/pureftpd.log NoChmod                     yes KeepAllFiles                yes CreateHomeDir               yes # Quota                       1000:10 PIDFile                     /var/run/pure-ftpd.pid # CallUploadScript yes # MaxDiskUsage               99 # NoRename                  yes CustomerProof              yes # PerUserLimits            3:20 # NoTruncate               yes # TLS                      1 IPV4Only                 yes # IPV6Only                 yes FileSystemCharset       utf8 ClientCharset           cp1251" > /etc/pure-ftpd/pure-ftpd.conf

Create mysql configuration file for pure-ftpd.

MySQL configuration file for  pure-ftpd:

root@server:~# echo " MYSQLSocket      /var/run/mysqld/mysqld.sock #MYSQLServer     localhost #MYSQLPort       3306 MYSQLUser       pureftpd MYSQLPassword   pureftpdpass MYSQLDatabase   pureftpd #MYSQLCrypt md5, cleartext, crypt() or password() - md5 is VERY RECOMMENDABLE uppon cleartext MYSQLCrypt      md5 MYSQLGetPW      SELECT Password FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") MYSQLGetUID     SELECT Uid FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") MYSQLGetGID     SELECT Gid FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") MYSQLGetDir     SELECT Dir FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") MySQLGetBandwidthUL SELECT ULBandwidth FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") MySQLGetBandwidthDL SELECT DLBandwidth FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") MySQLGetQTASZ   SELECT QuotaSize FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") MySQLGetQTAFS   SELECT QuotaFiles FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")" > /etc/pure-ftpd/mysql.conf

Start apache server:

root@server:~# /etc/init.d/httpd start

Start mysql server:

root@server:~# /etc/init.d/mysqld start

Restart pure-ftpd daemon:

root@server:~# /etc/init.d/pure-ftpd restart

systemctl restart httpd.service

systemctl restart mariadb.service

Now you can start Pure-FTPd WebUI installation.

                                     ----------------------------------X------------------------------

WebUI installation

Download src to web server root (/var/www, /var/www/html)

Ubuntu:

root@server:~# cd /var/www root@server:~# git clone git://github.com/mazay/pure-ftpd-webui.git root@server:/var/www# chown www-data:www-data -R /var/www/pure-ftpd-webui

CentOS:

root@server:~# cd /var/www/html root@server:~# git clone git://github.com/mazay/pure-ftpd-webui.git root@server:/var/www/html# chown apache:apache -R /var/www/html/pure-ftpd-webui

Database setup

systemctl restart httpd.service

systemctl restart mariadb.service

Create a password for the MySQL user root

#  mysql_secure_installation

Next steps are the same in different distributives. Create database and user pureftpd for connection to MySQL database:

root@server:~# mysql -u root -p Enter password:  mysql> CREATE DATABASE pureftpd;  mysql> GRANT ALL PRIVILEGES ON pureftpd.* TO 'pureftpd'@'localhost' IDENTIFIED BY '123456';

      FLUSH PRIVILEGES;        exit

Create neccesary tables in pureftpd database (sql files is in INSTALL folder)

root@server:~# mysql -u root -p pureftpd < pure-ftpd-webui_users-table_0.0.9.sql   OR

               mysql -u root -p pureftpd < pure-ftpd-webui/INSTALL/pure-ftpd-webui_users-table_0.0.9.sql Enter password: root@server:~# mysql -u root -p pureftpd < pure-ftpd_users-table_0.0.9.sql        OR

                       mysql -u root -p pureftpd < pure-ftpd-webui/INSTALL/pure-ftpd_users-table_0.0.9.sqlEnter password:

The same step can be done like that. Create the table for  pure-ftpd users:

root@server:~# mysql -u root -p Enter password:mysql> USE pureftpd;mysql> CREATE TABLE `ftpd` (   `id` int(11) NOT NULL AUTO_INCREMENT,   `User` varchar(16) NOT NULL DEFAULT '',   `status` enum('0','1') NOT NULL DEFAULT '0',   `Password` varchar(64) NOT NULL DEFAULT '',   `Uid` varchar(11) NOT NULL DEFAULT '2001',   `Gid` varchar(11) NOT NULL DEFAULT '2001',   `Dir` varchar(128) NOT NULL DEFAULT '/media/FTP',   `ULBandwidth` int(5) NOT NULL DEFAULT '0',   `DLBandwidth` int(5) NOT NULL DEFAULT '0',   `comment` tinytext NOT NULL,   `ipaccess` varchar(15) NOT NULL DEFAULT '*',   `QuotaSize` int(6) NOT NULL DEFAULT '0',   `QuotaFiles` int(11) NOT NULL DEFAULT '0',   PRIMARY KEY (`User`),   KEY `id` (`id`)) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;

Create the table for pure-ftpd-webui users:

mysql> CREATE TABLE `userlist` (   `id` int(3) NOT NULL AUTO_INCREMENT,   `user` varchar(50) COLLATE utf8_bin NOT NULL,   `pass` varchar(50) COLLATE utf8_bin NOT NULL,   PRIMARY KEY (`id`)) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

Creating administraive user

Create administraive user of pure-ftpd-webui:

mysql> INSERT INTO userlist (user,pass) VALUES ('admin',md5('adminpass'));

Configuration file

Create  apache configuration file for pure-ftpd-webui Ubuntu:

root@server:~# echo "Alias /pure-ftpd-webui /var/www/pure-ftpd-webui  <Directory /var/www/pure-ftpd-webui>     Options +FollowSymLinks     AllowOverride None     order allow,deny     allow from all      AddType application/x-httpd-php .php      <IfModule mod_php5.c>         php_flag magic_quotes_gpc On         php_flag short_open_tag On         php_flag register_globals On         php_flag register_argc_argv On         php_flag track_vars On         # this setting is necessary for some locales         php_value mbstring.func_overload 0         php_value include_path .     </IfModule>      DirectoryIndex index.php </Directory>" > /etc/apache2/conf.d/pure-ftpd-webui.conf

CentOS:

root@server:~# echo "Alias /pure-ftpd-webui /var/www/html/pure-ftpd-webui  <Directory /var/www/html/pure-ftpd-webui>     Options +FollowSymLinks     AllowOverride None     order allow,deny     allow from all      AddType application/x-httpd-php .php      <IfModule mod_php5.c>         php_flag magic_quotes_gpc On         php_flag short_open_tag On         php_flag register_globals On         php_flag register_argc_argv On         php_flag track_vars On         # this setting is necessary for some locales         php_value mbstring.func_overload 0         php_value include_path .     </IfModule>      DirectoryIndex index.php </Directory>" > /etc/httpd/conf.d/pure-ftpd-webui.conf

Finish installation

Restart  apache server:

root@server:~# apachectl restart

or Ubuntu:

root@server:~# /etc/init.d/apache2 restart

CentOS:

root@server:~# /etc/init.d/httpd restart

systemctl restart httpd.service

systemctl restart mariadb.service

http://server_ip/pure-ftpd-webui/install.php

Open  http://your_server/pure-ftpd-webui in your browser and enter administrative user's login and password.

beta 0.1.0 and later versions

Download and unpack the Pure-FTPd WebUI  archive to your webserver's root folder. Or you can use git:

root@server:~# cd /var/www root@server:/var/www# git clone git://github.com/mazay/pure-ftpd-webui.git

Make sure the Pure-FTPd WebUI directory is writable by webserver's user:

root@server:/var/www# chown www-data:www-data -R /var/www/pure-ftpd-webui

Run installation by opening:  http://server_ip/pure-ftpd-webui/install.php in your web browser.

                                  --------------------X----------------------------

# cd /var/www/html

# yum install git

下載 Pure-FTPd WebUI

# git clone git://github.com/mazay/pure-ftpd-webui.git

Initialized empty Git repository in /var/www/html/pure-ftpd-webui/.git/

remote: Reusing existing pack: 554, done.

Receiving objects: 100% (554/554), 846.22 KiB | 325 KiB/s, done.

remote: Total 554 (delta 0), reused 0 (delta 0)

Resolving deltas: 100% (314/314), done.

改變目錄的使用者和群組

# chown -R apache:apache /var/www/html/pure-ftpd-webui

建立資料庫 pureftpdb

# mysqladmin -u root -p create pureftpdb

 pureftpdb

#  mysql -u root -p -e "GRANT ALL PRIVILEGES ON pureftpdb.* TO 'pureftpd'@'localhost' IDENTIFIED BY 'pureftpdpass';"

檢查是否有設定完成

#  mysql -u root -p -e "SHOW GRANTS FOR pureftpd@localhost;"

Enter password:

+-----------------------------------------------------------------------------------------------------------------+

| Grants for pureftpd@localhost                                                                                   |

+-----------------------------------------------------------------------------------------------------------------+

| GRANT USAGE ON *.* TO 'pureftpd'@'localhost' IDENTIFIED BY PASSWORD '*F78AF3FDFBCD19918F457A682B481EF35DBF6806' |

| GRANT ALL PRIVILEGES ON `pureftpdb`.* TO 'pureftpd'@'localhost'                                                 |

+-----------------------------------------------------------------------------------------------------------------+

匯入 sql 資料表

#  mysql -u root -p pureftpdb < pure-ftpd-webui/INSTALL/pure-ftpd-webui_users-table_0.0.9.sql

#  mysql -u root -p pureftpdb < pure-ftpd-webui/INSTALL/pure-ftpd_users-table_0.0.9.sql

設定管理者 admin / adminpass

# mysql -u root -p pureftpdb -e "INSERT INTO userlist (user,pass) VALUES ('admin',md5('adminpass'));"

設定網頁目錄

# vim /etc/httpd/conf.d/pure-ftpd-webui.conf

 [root@mail conf.d]# vi pure-ftpd-webui.conf Alias /pure-ftpd-webui /var/www/html/pure-ftpd-webui  <Directory /var/www/html/pure-ftpd-webui>     Options +FollowSymLinks     AllowOverride None     order allow,deny     allow from all      AddType application/x-httpd-php .php      <IfModule mod_php5.c>         php_flag magic_quotes_gpc On         php_flag short_open_tag On         php_flag register_globals On         php_flag register_argc_argv On         php_flag track_vars On         # this setting is necessary for some locales         php_value mbstring.func_overload 0         php_value include_path .     </IfModule>      DirectoryIndex index.php </Directory>

重新啟動瀏覽器

# service httpd restart

打開網頁瀏覽器

http://Server'IP/pure-ftpd-webui

 

-----------