Sunday, September 26, 2010

HowTo: Install vsftp on ubuntu


Installing vsftpd using text file for virtual users
vsftpd is a secure, fast and stable FTP server. In this tutorial we'll install the server and make it check in a flat text file for virtual users allowed to login.
#1. Install required packages
sudo apt-get install vsftpd libpam-pwdfile

#2. Configure vsftpd (sudo pico /etc/vsftpd.conf)
Edit these variables in the config file and leave everything else with the default value.

anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
chroot_local_user=YES
virtual_use_local_privs=YES
guest_enable=YES
user_sub_token=$USER
local_root=/var/www/$USER
hide_ids=YES

Set the local_root to the parent directory where the user's home directories are located

#3. Configure PAM to check the passwd file for users (sudo pico /etc/pam.d/vsftpd)

auth required pam_pwdfile.so pwdfile /etc/ftpd.passwd
account required pam_permit.so

Make sure you remove everything else from the file

#4. Create the passwd file containing the users

sudo htpasswd -c /etc/ftpd.passwd user1

You can later add additional users to the file like this:

sudo htpasswd /etc/ftpd.passwd user2

#5. Restart vsftpd

sudo /etc/init.d/vsftpd restart

#6. Create user's home directory since vsftpd doesn't do it automatically

sudo mkdir /var/www/user1

Your done.

HowTo: Linux vsftpd ftp service / server install, configuration

Ubuntu Linux comes with various ftp servers to setup FTP service such as:

=> proftpd - Versatile, virtual-hosting FTP daemon
=> vsftpd - The Very Secure FTP Daemon
=> ftpd - FTP server
=> wu-ftpd - powerful and widely used FTP server
=> wzdftpd - A portable, modular, small and efficient ftp server
=> pure-ftpd - Pure-FTPd FTP server
I recommend using vsftpd. It is simple and quite secure FTP server. According to vsftpd man page:
vsftpd is the Very Secure File Transfer Protocol Daemon. The server can be launched via a super-server such as inetd or xinetd. Alternatively, vsftpd can be launched in standalone mode, in which case vsftpd itself will listen on the network.