vsFTPd, ProFTPD and PureFTPd are great choices for an FTP server that all work well. Each has a GUI applications available to help manage settings. However PureFTPd is lightweight, supports MLST/MLSD, supports virtual folders using symbolic links (symlinks) and supports the SITE UTIME command required to synchronize file date/time stamps when you transfer them. It is therefore the FTP server that typically I recommend on Linux.
To install PureFTPd in Ubuntu (and probably most Debian based releases), execute the following command and a terminal/shell prompt:
sudo apt-get install pure-ftpd
By the way, if for any reason you mess-up the Pure-FTPD installation and want to start over, you can uninstall it completely using all of the following set of commands:
sudo service pure-ftpd stop
sudo apt-get autoremove pure-ftpd
sudo apt-get purge pure-ftpd
sudo rm -r /etc/pure-ftpd
Unlike most FTP servers, Pure-FTPd has almost no configuration files. It is all command-line driven.
If you plan on using virtual users on your ftp-server instead of regular Linux user accounts, start by creating an unprivileged user and group that is dedicated to those users using the following commands:
sudo groupadd ftpgroup
sudo useradd -g ftpgroup -d /dev/null -s /etc ftpuser
sudo chown -R ftpuser:ftpgroup /home/ftpuser
This will also create a shared space called ftpuser. This will be the root of their access on the server if you create your users in chroot jail where they can't move up to higher levels. Of course you can alternatively create individual directories for each user instead if you don't want them to have shared space and then optionally link them to a specially setup shared area using a symlink. We'll get to the topic of symlinks shortly.
The ftpgroup group and the ftpuser user will be needed when you are setting up users in your ftp server.
Managing Pure-FTP Virtual Users
Managing users from the command line is pretty simple. Note that Pure-FTPd users can alternatively be managed using a MySQL database. That topic is not covered here but should be considered if you want to optimize management of thousands of ftp users on your sever.
Here are the commands (you can script them) to manage your users. Be sure to replace $USERNAME with the actual user id of the individual user.
Creating the First User
sudo pure-pw useradd $USERNAME -u ftpuser -d /home/ftpuser
sudo pure-pw mkdb
… if creating an admin user with full access to the server, omit the -d /home/ftpuser parameter which would normally causes this directory to become the root of the users ftp session.
Creating Additional Users
In chroot jail:
sudo pure-pw useradd $USERNAME -u ftpuser -d /home/ftpuser -m
Not in chroot jail:
sudo pure-pw useradd $USERNAME -u ftpuser -D /home/$USERNAME -m
View a User
sudo pure-pw show $USERNAME
Change a User's Password
sudo pure-pw passwd $USERNAME -m
Update an Existing User
See Pure-FTPd documentation for a list of options to replace $OPTIONS.
sudo pure-pw usermod $USERNAME $OPTIONS -m
Deleting a User
sudo pure-pw userdel $USERNAME -m
Listing All Users
sudo pure-pw list
Update the User/Password Database Manually
(in case you forgot the -m)
sudo pure-pw mkdb
Managing the Pure-FTP Server
Start Pure-FTPd Server
sudo service pure-ftpd start
Note: This does not disconnect active users.
sudo service pure-ftpd stop
Disconnect All Active Users Immediately
sudo killall pure-ftpd
sudo service pure-ftpd status
sudo service pure-ftpd restart
View Server Activity
Changing the Welcome Message
This message is only visible to command line users and in some FTP clients. To see what your server currently displays, open a command prompt and type:
In order to customize or even remove this message, you must create a FortunesFile file:
sudo echo "/home/ftpuser/fortunes.txt" > /etc/pure-ftpd/conf/FortunesFile
In the fortunes.txt file, put any message you want to display or leave it empty.
Setting Pure-FTPd to Start-up When the Server Restarts
Important: You must do the following or the server will not recognize virtual users after you restart the server:
sudo echo 'no' > PAMAuthentication
sudo echo 'no' > UnixAuthentication
sudo echo '/etc/pure-ftpd/pureftpd.pdb' > PureDB
sudo ln -s ../conf/PureDB /etc/pure-ftpd/auth/50pure
Pure-FTPd supports virtual symbolic links (a.k.a. symlinks) to directories in other palces on the server -- outside your home directory. For example, you can create one using the following commands:
Create a symlinks to each of the different areas on the server that they will need access to:
ln -s /var/www /home/ftpuser/www
To remove a symbolic link, simply delete it. Example:
This will only delete the symbolic link and not the contents of the folder. Just be sure it is a symbolic link and not a mounded directory though.
If you have any trouble making changes to files on your Apache server, try adding www-data to the ftpgroup group.