Pure-ftpd
Installing pure-ftpd
There are many open-source ftp server solutions out there, but this guide focuses on pure-ftp due to its integration with mySQL and apache.
$ sudo emerge -av pure-ftpd
after the daemon has been installed, you need to configure it.
sudo nano -w /etc/conf.d/pure-ftpd
Uncomment the configuration flag
IS_CONFIGURED="yes"
Configure ssl support
MISC_OTHER="-A '-Y 1' -j -R -Z"
Add the MySQL authenticator at the end of the file
AUTH="-l mysql:/etc/pureftpd-mysql.conf"
now we will configure ssl support.
sudo mkdir -p /etc/ssl/private sudo openssl req -x509 -nodes -newkey rsa:1024 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem
answer the questions asked. once it is done
sudo chmod 600 /etc/ssl/private/pure-ftpd.pem
next, we'll download a user manager for pureftpd
cd /var/www/localhost/htdocs sudo wget http://machiel.generaal.net/files/pureftpd/ftp_v2.1.tar.gz
next we extract the file
sudo tar zxf ftp_v2.1.tar.gz (or whatever version you downloaded)
once the files have extracted, we need to set permissions so that they work correctly
sudo chown -R apache:apache ftp sudo chmod 664 ftp/config.php
To start the ftp setup wizard, open a browser and go to
http://localhost/ftp/install.php
Go through the installation as you see fit. Be sure to change the default password from tmppasswd to something else. When you reach the final step, copy and paste the contents of the generated pureftpd-mysql.conf file, and create it.
sudo nano /etc/pureftpd-mysql.conf (copy and paste the file contents and save the file)
once you are done, close the installation wizard. you may find the 16 char limit for user names annoying. to change that, log into mysql as root
mysql -u root -p
change to the ftpusers database
use ftpusers;
modify the users table
alter table users modify User varchar(32);
then exit mysql
quit
next we will try to start the ftp server
sudo /etc/init.d/pure-ftpd start
add the ftp service to startup
sudo rc-update add pure-ftpd default
if all has gone well, we just need to delete the user manager tarball
sudo rm /var/www/localhost/htdocs/ftp_v2.1.tar.gz
and don't forget the rename the publicly accessible installation file (wow!)
sudo mv /var/www/localhost/htdocs/ftp/install.php /var/www/localhost/htdocs/ftp/install