Installing Pure-FTPd on Ubuntu 9.04 Server

May 31, 2009
Although I no longer install FTP servers on any of my Linux servers, as I favour the user of SFTP, I wanted to update my instructions for the newest version of Ubuntu Server. I’m sure these instructions are very similar for most distributions, but I thought I’d specifically target Ubuntu 9.04 Server since that is what I am most familiar with.
sudo apt-get install pure-ftpd

When prompted, enter Y and hit enter.

Now, set up a new account using the ‘useradd’ command. You’ll also need to specify the home directory for the user by adding ‘-d /home/directoryname -m’ so when the user logs in they have a folder to upload/download files from.  You don’t have to use the /home dirctory for this but I always do to make things simple.  Here is the command I used.

sudo useradd -d /home/username -m username
sudo passwd username

Since I don’t want this user being able to cruise through the file system and see everything I’m going to lock the user to the home directory we just made. Open up /etc/passwd for editing. I use pico for this, you can use whatever program you like. Search for the user you just made (ctrl+w in pico) and add /./ to their home directory like this:

sudo pico /etc/passwd

Note that the line will be a lot messier than that, so just squeeze it in where appropriate. Also, make sure to put in a shell at the end of that line /bin/bash works fine. After all of that, add their username to /etc/ftpallow if you want to manually allow access to certain accounts.

Now just type pure-ftpd-control restart on the command line and you’re ready to test out your account!  Hop on another computer, or just SSH into another one and try from there.  If it doesn’t work its possible your install didn’t set up some of the proper configuration.  This happens automatically on Ubuntu 9.04 Server but on other distrobutions you may need to perform this next step.

Edit /etc/pam.d/pure-ftpd using your favourite editor to look like this:

auth sufficient pam_ftp.soauth required shadow use_first_pass
auth required item=user sense=deny file=/etc/ftpusers onerr=succeed
auth required item=user sense=allow file=/etc/ftpallow onerr=fail
auth required

Save the file, restart the server again and try it out again.  If you’re having troubles still I suggest seeking help from the Documentation.

Only registered users can comment.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.