How to install and configure VSFTPD server in Ubuntu 16.04

VSFTPD stands for Very Secure FTP(File Transfer Protocol) Daemon is designed for uploading and downloading the data on server. It helps user to upload and download data from server to client in any location whether user is in Local Area Network or Wide Area Network .

Server information
Operating System: Ubuntu16.04
Server IP Address:
Package name : vsftpd
configuration file : /etc/vsftpd.conf
Document root : /var/ftp/pub
Service name : vsftpd
FTP Server listen on : 21

Client Information
Operating System : Any Windows or Linux
Client IP Address :
Client Software : Filezilla

Above are server and client information. In this tutorial we will show you how to install and configure FTP/VSFTP Server in simple step by step.

Install VSFTPD package on server
sudo apt update
sudo apt-get install vsftpd

After installation package start and enable VSFTPD service
sudo systemctl start vsftpd.service
sudo systemctl enable vsftpd.service

Backup the default configuration file before any changes
sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.orig

Choose any file editor in which you are comfortable to modify configuration file.
You can configure vsftpd server in two way.
1. Anonymous configuration ( For public access in which no user name and password required)
2. User based configuration ( For authentication access, in which user name and password requred)

Anonymous configuration
sudo vim.tiny /etc/vsftpd.conf
#Search below parameter in config file.
anonymous_enable=YES (this prameter allow to share data in pub direcory )

Create directory for anonymous space
sudo mkdir -p /var/ftp/pub

Change ftp ownership
sudo chown ftp:ftp /var/ftp/pub

Restart vsftpd service to take effect.
sudo service vsftpd restart

Access FTP Server from Client Machine
You can access FTP server using Windows Explorer, Any of Internet Browser or through FileZilla Software.
Open Browser and type url ftp://server-ipaddress

Access ftp from command line
$  ftp
Connected to
220 (vsFTPd 3.0.3)
Name ( ftp
331 Please specify the password.
Password:                    (Hit enter, Anonymous user has no password)
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.

ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
drwxr-xr-x 2 125 133 4096 Aug 26 21:30 pub
226 Directory send OK.

ftp> cd pub
250 Directory successfully changed.

#list files
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-r–r– 1 0 0 0 Aug 26 21:30 file.txt
226 Directory send OK.

#Download file using get
ftp> get file.txt
local: file.txt remote: file.txt
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for file.txt (0 bytes).
226 Transfer complete.

#Upload file using put command, anonymous user can’t upload files
ftp> put file.txt
local: file.txt remote: file.txt
200 PORT command successful. Consider using PASV.
550 Permission denied.

Configure User based FTP Server
Create one or more user
sudo adduser user1
sudo adduser user2

Set password for user
sudo passwd user1
sudo passwd user2

Configure user based FTP Server
sudo vim.tiny /etc/vsftpd.conf
anonymous_enable=NO (Change YES to NO if you configure user based FTP Server )

After changing in Config file , Restart ftp service.
sudo service vsftpd restart

Now Access FTP Server from Client machine using FileZilla Software.
In software you need to put Server IP Address , User Name and password of user.

Successfully you have configured user based FTP server .
One thing i have noticed in above ftp access, User can access their home directory using ftp access but also they are entering in “/” directory when user access ftp server using command line.

Access ftp server using command line

So, you need to restrict user to work on their home directory only . To perform this action we need enable Chroot Environment in ftp config file . We also call it Jail Environment .

Enable Chroot Environment
sudo vim /etc/vsftpd.conf


#Allow user who has ftp access

Create File “/etc/chroot_list” and put user inside .
sudo vim.tiny /etc/vsftpd.chroot_list

Create file for ftp access /etc/vsftpd.userlist
sudo vim.tiny /etc/vsftpd.userlist

Restart vsftpd service
sudo service vsftpd restart

Now Finally access FTP server from command line.

So, now you learnt VSFTPD server installation and configuration in this tutorial, we will be posting more new industrial based topic in our next tutorial. Please comment write your requirement in comment area.

Leave a Reply

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