Search:  
Gentoo Wiki

PureFTPd

Wikipedia has an article on:
Pure-FTPd

Contents

About

PureFTPd is a free (BSD license) FTP Server.

Install

Code: Install PureFTPd
emerge -av net-ftp/pure-ftpd
net-ftp/pure-ftpd -ldap +mysql +pam +ssl +vchroot
Code: Get the version number
emerge -pv net-ftp/pure-ftpd

Configure

Configure PureFTPD

Like all configuration files on Gentoo, the pure-ftpd configuration file is placed in /etc/conf.d.

Open /etc/conf.d/pure-ftpd:

nano -w /etc/conf.d/pure-ftpd

Uncomment the configuration flag

IS_CONFIGURED="yes"

Add the MySQL authenticator at the end of the file

AUTH="-l mysql:/etc/pureftpd-mysql.conf"

Save and exit nano.

Basic configuration

Adding SSL Support

In order to add SSL support to pure-ftpd you need to insure that you have emerged pure-ftpd with the ssl use flag.

Then make a .pem cert.

mkdir -p /etc/ssl/private
openssl req -x509 -nodes -newkey rsa:1024 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem
chmod 600 /etc/ssl/private/pure-ftpd.pem

Then edit MISC_OTHER in /etc/conf.d/pure-ftpd to enable ssl support.

Add '-Y x' into MISC_OTHER field where x is;

 '-Y 0': Disable the SSL/TLS encryption layer (default).
 '-Y 1': Accept both standard and encrypted sessions.
 '-Y 2': Refuse connections that aren't using SSL/TLS security mechanisms,

User management

Requirements:

Make sure, PHP is compiled with the following USE flags:

If you are missing one of these USE flags, add them in the /etc/make.conf and update PHP

emerge -avu php

The pure-ftpd usermanager is not in Portage, so download and install it manually. Change path to your website document folder:

cd /var/www/localhost/htdocs

Get the tar ball:

wget http://machiel.generaal.net/files/pureftpd/ftp_v2.1.tar.gz

Untar, this wil create the Usermanager in the folder ftp:

tar zxf ftp_v2.1.tar.gz

For the created folder, change owner to the proper user/group:

chown -R apache:apache ftp

Make sure install is named install.php

cd ftp
mv install install.php

Make config.php writable

chmod 664 config.php

The documentation its pretty easy to follow, the file you have to edit is the config.php

 vim config.php

This will enable you to establish a connection to the mysql server, and install the database for pure-ftpd.

Fireup the install.php in your favorite webbrowser:

http://localhost/ftp/install.php

Follow the installation wizard, you will be guided in 7 steps

  1. Choose New installation, create a new database.
  2. Fill in the hosts/username/password to administrate Mysql, this information is used to create the ftpusers database
  3. Fill in the hosts/username/password for the ftpusers database, this information is used by pure-ftpd to connect to Mysql
  4. Fill in all the stuff, this information is used by the Usermanager in PHP to modify the ftpusers database
    1. When done press the Save button to write the configuration to the config.php file
  5. Fill in a proper password for the Administrator user, this is used to login in the Usermanager
    1. Press the Change button to save the password
  6. Copy all text in the gray block from Step B, paste the text in /etc/pureftpd-mysql.conf and save it
  7. Close the installation wizard

If you have any trouble at this point, you should consult the documentation of the User Manager for Pure-FTPd. You might want to use phpMyadmin if you don't know how to use mysql.

After you finish installing the Manager ( and creating the purepftpd-mysql.conf file ), you open your web browser and go to :

http://localhost/ftp

Note Make sure you have a valid password for the ftpusers database user. It must not be empty, or Pure-FTPd will fail to start.

Add users

You first need to start PureFTPd (see PureFTPd#Start PureFTPd). Then open the Usermanager, it is an web application so go to

http://localhost/ftp/

Log in with the password as defined in the installation wizard (Step 5). You should now be able to add/delete/modify virtual users.

Start PureFTPd

Start the FTP server

/etc/init.d/pure-ftpd start

If it fails to start, check the log file

tail /var/log/messages

If it succeeds, let pure-ftpd start automatically

rc-update add pure-ftpd default

Clean up

When all is set and done there are some loose ends we have to take care off. There is a serious security breach when the install.php is public accessible. So delete it or rename it To delete:

rm /var/www/localhost/htdocs/ftp/install.php

or rename:

mv /var/www/localhost/htdocs/ftp/install.php /var/www/localhost/htdocs/ftp/install

Delete the downloaded Usermanager tarball:

rm /var/www/localhost/htdocs/ftp_v2.1.tar.gz

See also

[updated to use user manager for pure-ftpd - ikaro at fluxbox dot org ]


Last modified: Sat, 06 Sep 2008 11:01:00 +0000 Hits: 4,163