Linux

Installing Pure-FTPd on Ubuntu 8.04 Server

January 26, 2009

Until recently my choice for an FTP server had always been ProFTPd, however I found its difficulty to install made it a constant chore every time I had to set up a server.  So I sought out an alternative that was quick and easy to install yet did not sacrifice functionality or security.  The answer was Pure-FTPd.

I€™m sure these instructions are very similar for most distributions, but I thought I€™d specifically target Ubuntu 8.04 Server since that is what I am installing it on today. If you are using the desktop edition of Ubuntu or another distrobution that has a GUI you can most likely use that alternative.  Instead of apt-get commands you would simply fire up the Synaptic Package Manager and search for the install package.

I tend to jump right to the super user when I log in (bad habit, I know).  So if you’re not doing that you will have to prefix all commands with ‘sudo’ or they might not work. Start off by installing the program and all of its required packages.

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.

useradd -d /home/username -m username
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:

/home/username/./

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 8.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.so
auth required pam_unix_auth.so shadow use_first_pass
auth required pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
auth required pam_listfile.so item=user sense=allow file=/etc/ftpallow onerr=fail
auth required pam_shells.so

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.