install Pure-FTPd on Ubuntu
I’m sure these instructions are similar for most distributions, but I thought I’d specifically target Ubuntu so that I don’t have to cover the little differences that each and every person might run into. The end result of this is to have a fast and secure FTP server running on Linux that, when given the proper credentials, will serve up a user’s home directory. You can imagine when this would be useful. I decided to go with Pure-FTPd for quite a few reasons, but mainly because of solid security and many configuration options. I’ve gotten myself into trouble before by choosing very simple FTPd servers and realizing later that they just weren’t able to do what I wanted them to do. Pure-FTPd is different that way.
So to get started, in Ubuntu just use apt to get Pure-FTPd installed:
apt-get install pure-ftpd
Now, set up a new user, and open up /etc/passwd for editing. Add /./ to their home directory like this:
This keeps them from seeing the filesystem.
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.
Now it’s time to give Pure-FTPd a basic configuration. Edit /etc/pam.d/pure-ftpd 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
Now just type pure-ftpd-control restart on the command line and you’re all finished!