FTP is used to transfer files from one host to another over TCP network. This article explains how to setup FTP server on ubuntu 14.04 .
There are 3 popular FTP server packages available PureFTPD, VsFTPD and ProFTPD. Here i’ve used VsFTPD which is lightweight and less Vulnerability.
Setup FTP server on Ubuntu 14.04
Step 1 » Update repositories .
1 |
sudo apt-get update |
Step 2 » Install VsFTPD package using the below command.
1 |
sudo apt-get install vsftpd |
Step 3 » After installation open /etc/vsftpd.conf file and make changes as follows.
Uncomment the below lines (line no:29 and 33).
1 2 |
write_enable=YES local_umask=022 |
Uncomment the below line (line no: 120 ) to prevent access to the other folders outside the Home directory.
1 |
chroot_local_user=YES |
and add the following line at the end.
1 |
allow_writeable_chroot=YES |
Add the following lines to enable passive mode.
1 2 3 |
pasv_enable=Yes pasv_max_port=40000 pasv_min_port=40100 |
Step 4 » Restart vsftpd service using the below command.
1 |
sudo service vsftpd restart |
Step 5 » Now ftp server will listen on port 21. Create user with the below command.Use /usr/sbin/nologin shell to prevent access to the bash shell for the ftp users .
1 2 |
sudo useradd -m john -s /usr/sbin/nologin sudo passwd john |
Step 6 » Allow login access for nologin shell . Open /etc/shells and add the following line at the end.
1 |
/usr/sbin/nologin |
Now try to connect this ftp server with the username on port 21 using winscp or filezilla client and make sure that user cannot access the other folders outside the home directory.
Please note using ftp on port 21 is a big security risk . it’s highly recommended to use SFTP. Please continue for SFTP configuration