It should be very simple to set up an FTP server on a Linux server but for some reason I always seem to have an issue with it. The first question is which daemon to install when there are so many. The main three contenders seem to be pure-ftpd, proftpd and vsftpd but even choosing between them can be daunting.
Many (if not all) FTP servers seem to have been written with the intent to either providing FTP access for people with shell accounts on the FTP server or for anonymous users. I have no interest in anonymous access and the only one with local account that need file access is myself and I much prefer to use scp via Cyberduck instead. So my requirement for a pure virtual FTP server is usually not mainstream and I invariably find myself lost in all configuration descriptions.
Here is a simple step for setting up pure-ftpd on a Debian system and add an account:
- Install the server [apt-get install pure-ftpd]
- Create an FTP group [groupadd ftp]
- Create an FTP user [useradd -g ftp -d /dev/null -s /etc ftp]
- Create a folder to hold the FTP data [mkdir /var/ftp]
- Change owner on the folder [chown ftp:ftp /var/ftp]
- Add a pure-ftpd user [pure-pw useradd testuser -u ftp -d /var/ftp -N 300]
- Save the changes [pure-pw mkdb]
- Run the server [/usr/sbin/pure-ftpd -j -lpuredb:/etc/pure-ftpd/pureftpd.pdb &]
To start the server automatically, use xinetd and add the following to /etc/xinetd.d/ftp:
socket_type = stream
server = /usr/sbin/pure-ftpd
server_args = -j -lpuredb:/etc/pure-ftpd/pureftpd.pdb
protocol = tcp
user = root
wait = no
disable = no
Then restart xinetd (/etc/init.d/xinetd restart).