This post shows students and new users how to install VSFTPD with SSL/TLS support on Ubuntu 17.04 / 17.10. VSFTPD is an opensource program that uses File Transfer Protocol (FTP) to enable file uploads and downloads.
There are other opensource programs that use FTP protocol to transfer files on Linux systems, but VSFTPD is probably the most popular and easier to configure. VSFTPD daemon listens continuously for FTP requests from FTP clients. If the request is valid and the user is authorized, access will be granted.
Access can be managed two ways… anonymous and authenticated.
After installing, the commands below can be used to stop, start and enable VSFTPD service to always startup when the server boots
Then, make the following highlighted changes below and save the file.
Example config file /etc/vsftpd.conf
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# Run standalone? vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
# This directive enables listening on IPv6 sockets. By default, listening
# on the IPv6 "any" address (::) will accept connections from both IPv6
# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
# sockets. If you want that (perhaps because you want to listen on specific
# addresses) then you must run two copies of vsftpd with two configuration
# Allow anonymous FTP? (Disabled by default).
# Uncomment this to allow local users to log in.
# Uncomment this to enable any form of FTP write command.
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
# If enabled, vsftpd will display directory listings with the time
# in your local time zone. The default is to display GMT. The
# times returned by the MDTM FTP command are also affected by this
# Activate logging of uploads/downloads.
# Make sure PORT transfer connections originate from port 20 (ftp-data).
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# You may override where the log file goes if you like. The default is shown
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
# You may change the default value for timing out an idle session.
# You may change the default value for timing out a data connection.
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
## By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
After editing the file, save it.
After making the changes above, restart VSFTPD service by running the commands below
sudo systemctl restart vsftpd.service
Step 2: Configuring VSFTPD
If you want to block users, open the file below and add the user account and save the file.
sudo nano /etc/ftpusers
All the accounts in the file above will be denied FTP access.
To enable SSL/TLS encryption, follow the steps below.
First, run the commands below to create a folder to store the certificates
sudo mkdir -p /etc/ssl/certs
Then run the commands below to create a new one year self-signed SSL/TLS certificate and store in the folder above.
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/certs/vsftpd.pem -out /etc/ssl/certs/vsftpd.pem
Then you run the commands above, you’ll be asked series of questions to incorporate into the certificate. Use the guide below to answer
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:MN
Locality Name (eg, city) :BP
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) :none
Common Name (e.g. server FQDN or YOUR name) :localhost
Email Address :
After generating the certificate, open /etc/vsftpd.conf file and add the lines below and save.
Restart the server and you’re done.
To test, open an FTP client and connect, you should be prompted allow to confirm the certificate presented to the client.
You may also like the post below:
Installing Webmin on Ubuntu 17.04 / 17.10