Because I am running my servers over nfs storage, there were problems with proftpd (Sessions were timing out, stalled during transfers, etc). So, I decided to run an alternative ftp daemon.
My first attempt was to run vsftpd, which is a great ftp daemon but it has some limitations regarding virtual users and is therefor not really compatible with a SysCP host running more than 1 customer. It requires a (no longer supported) module which creates virtual user configfiles on disk.
I remembered from way back ;) that pure-ftpd also supports authentication modules and one of them is mysql, so I gave that a try and I am glad I did ;) As it is now running happily in my vservers on NFS storage and my clients are up- and downloading faster than before!
The described installation was on Gentoo but it can be easily adapted to any distro of choice.
Gentoo:
emerge sync && USE="mysql" emerge pure-ftpd && rc-update add pure-ftpd default
After the installation has been finished, we need to configure pure-ftpd to use SysCP’s virtual users... All relevant settings can be found below:
As noted in the file itself, be sure to check the pure-ftpd README file for all switches and options. Remember that you have to remove the comment(#) to the #IS_CONFIGURED=”yes” line to be able to start the service.
# Config file for /etc/init.d/pure-ftpd ##Comment variables out to disable its features, or change the values in it... ## ## This variable must be uncommented in order for the server to start ## #IS_CONFIGURED="yes" ## FTP Server,Port (separated by comma) ## ## If you prefer host names over IP addresses, it's your choice : ## SERVER="-S ftp.rtchat.com,21" ## IPv6 addresses are supported. ## !!! WARNING !!! ## Using an invalid IP will result in server not starting and reporting ## a good start. Work is being done to solve that in: ## http://bugs.gentoo.org/show_bug.cgi?id=75861 #SERVER="-S 192.168.0.1,21" SERVER="-S 21" ## Number of simultaneous connections in total, and per ip ## MAX_CONN="-c 30" MAX_CONN_IP="-C 10" ## Start daemonized in background ## DAEMON="-B" ## Don't allow uploads if the partition is more full then this var ## DISK_FULL="-k 90%" ## If your FTP server is behind a NAT box, uncomment this ## #USE_NAT="-N" ## Authentication (others are 'pam', ...)## ## Further infos in the README file. AUTH="-l mysql:/etc/pure-ftpd/mysql.conf -l unix -l pam" ## Change the maximum idle time. (in minutes. default 15) #TIMEOUT="-I <timeout>'" ## Use that facility for syslog logging. It defaults to 'ftp' ## Logging can be disabled with '-f none' . #LOG="-f facility" ## Misc. Others ## # More can be found on "http://pureftpd.sourceforge.net/README" MISC_OTHER="-A -E -x -j -B"
In the previous config file, I specified that the mysql configuration is located in /etc/pure-ftpd/, this is not standard on Gentoo, so you have to run mkdir -p /etc/pure-ftpd/ prior to creating the file.
Another thing to note is that I choose to use MYSQLCrypt any instead of simply crypt. I did this to support both the older and the current versions of SysCP.
#MYSQLServer localhost #MYSQLPort 3306 MYSQLSocket /var/run/mysqld/mysqld.sock MYSQLUser syscp MYSQLPassword PASSWORD MYSQLDatabase syscp MYSQLCrypt any MYSQLGetPW SELECT password FROM ftp_users WHERE username="\L" AND login_enabled="y" MYSQLGetUID SELECT uid FROM ftp_users WHERE username="\L" AND login_enabled="y" MYSQLGetGID SELECT gid FROM ftp_users WHERE username="\L" AND login_enabled="y" MYSQLGetDir SELECT homedir FROM ftp_users WHERE username="\L" AND login_enabled="y"
Start pure-ftpd by running the below command and you’re in bussiness ;)
Gentoo:
/etc/init.d/pure-ftpd start
If you encounter problems, or have suggestions (perhaps an update on how to setup pure-ftpd on Debian), either post in the forum, or modify this wiki entry.