Difference between revisions of "Pure-ftpd"

From gr0x0rd
Jump to navigation Jump to search
 
Line 24: Line 24:
 
  '''$''' sudo chown -R apache:apache ftp
 
  '''$''' sudo chown -R apache:apache ftp
 
  '''$''' sudo chmod 664 ftp/config.php
 
  '''$''' sudo chmod 664 ftp/config.php
To start the ftp setup wizard, open a browser and go to
+
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  
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.
 
pureftpd-mysql.conf file, and create it.
 
+
'''$''' sudo nano /etc/pureftpd-mysql.conf
sudo nano /etc/pureftpd-mysql.conf
 
 
(copy and paste the file contents and save the file)
 
(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 this, log into mysql as root
once you are done, close the installation wizard. you may find the 16 char limit for user names annoying.
+
'''$''' mysql -u root -p
to change that, log into mysql as root
+
Change to the ftpusers database, modify the users table, then exit mysql.
 
+
mysql> use ftpusers;
mysql -u root -p
+
mysql> alter table users modify User varchar(32);
 
+
mysql> quit
change to the ftpusers database
+
Next we will try to start the ftp server
 
+
'''$''' sudo /etc/init.d/pure-ftpd start
use ftpusers;
+
Add the ftp service to startup
 
+
'''$''' sudo rc-update add pure-ftpd default
modify the users table
+
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
alter table users modify User varchar(32);
+
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.txt
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
 

Latest revision as of 10:43, 5 August 2011

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. Change the filename if you download a more recent file.

$ sudo tar zxf ftp_v2.1.tar.gz

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 this, log into mysql as root

$ mysql -u root -p

Change to the ftpusers database, modify the users table, then exit mysql.

mysql> use ftpusers;
mysql> alter table users modify User varchar(32);
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.txt