How To Set Up An FTPS Server in Linux - Open Source
How To Set Up An FTPS Server in Linux - Open Source
vsftpd is a very popular package for FTP (File Transfer Protocol) but poses a security threat because it transfers vital data
like usernames, passwords, etc, in plain text. To eliminate this risk, FTP offers encryption with the help of the SSL and TLS
protocols. This article explains how to set up an FTPS server in Linux.
FTP is a standardised network protocol and probably the quickest as well as easiest option available when a large chunk of
data is to be transferred from one host to another, over a TCP-based network. FTP defines a client-server architecture that
uses two separate well-known ports for data (Port No 20, used for data transfer) and control (Port No 21, used for
authentication) connections, in order to establish connectivity between the server and the client.
When it comes to the Linux operating system, the most popular package used to set up an FTP server is vsftpd or very
secure FTP daemon. It offers very basic features such as anonymous enabling/disabling, local enabling/disabling and chroot
jail for the users. But, when looked at from the security perspective, vsftpd has very few features to offer.
Whenever the file transfer is initiated, all the data, including user credentials and passwords, get transferred in an
unencrypted format, as plain text, which is considered to be very risky in any public network.
As a security measure, we have two options that offer secure file transfer capabilities, which are SFTP and FTPS. SFTP uses
an SSH connection to run file transfers over a secure channel, while FTPS uses cryptographic protocols such as SSL (Secure
Socket Layer) and TLS (Transport Layer Security). This article elaborates on the SFTP protocol in order to set up a secure
FTP server using SSL certificates.
https://www.opensourceforu.com/2015/03/set-up-an-ftps-server-in-linux/ 1/5
2/2/23, 8:27 How to set up an FTPS Server in Linux | Open Source
For our convenience, lets put the certificate and the key in the same file, and store that file as /etc/vsftpd/vsftpd.pem.
Once the above command is executed, you will be asked to provide some basic information. The output will be very similar
to:
https://www.opensourceforu.com/2015/03/set-up-an-ftps-server-in-linux/ 2/5
2/2/23, 8:27 How to set up an FTPS Server in Linux | Open Source
Now, let us edit the configuration file as per our requirements. You might need to find out the lines, or add them if they do
not pre-exist.
ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_sslv2=YES
ssl_sslv3=YES
local_enable=YES
anonymous_enable=NO
write_enable=YES
https://www.opensourceforu.com/2015/03/set-up-an-ftps-server-in-linux/ 3/5
2/2/23, 8:27 How to set up an FTPS Server in Linux | Open Source
With this setting, only a local user can access the FTP server and can issue write commands. But if you want to preserve
the individuality of the users and their contents, you can set up a chroot jail for the users, so that users are bound to work
in their home directories and are not permitted to access any files outside them.
chroot_local_user=YES
To enable logging of the transfers carried out, edit the following lines:
xferlog_enable=YES
xferlog_std_format=YES
xferlog_file=/var/log/ftp/xferlog
By default, after a fresh installation of any package, the service associated with that package is disabled on every run level.
This indicates that you will have to manually restart the service after the operating system switches from one run level to
another. In simple words, after every reboot or system startup, you will have to start the service manually.
You can verify this by issuing the chkconfig command
as follows:
To overcome this and to configure the service to start automatically, you can use:
chkconfig vsftpd on
https://www.opensourceforu.com/2015/03/set-up-an-ftps-server-in-linux/ 4/5
2/2/23, 8:27 How to set up an FTPS Server in Linux | Open Source
useradd mandar
To set the password for mandar, use the passwd command as follows:
passwd mandar
You will have to mention the new password and confirm it once:
Now, the user mandar will be able to use the FTPS services with any FTP client that supports SSL/TLS, such as FileZilla.
In order to access the FTPS server through browsers, you may require to install some add-ons like fireFTP.
You can limit access to the FTPS server, but allow people to use FTPS services at the same time, by changing their shell to
/sbin/nologin. Further, you can set a password policy for the users (/etc/pam.d/system-auth) to make them select a strong
password and change it regularly (chage command).
Mandar Shinde
The author works in the IT division of one of the largest commercial automotive organisations in India. His technical interests include Linux,
networking, backups and virtualisation.
Show/Write Comments
https://www.opensourceforu.com/2015/03/set-up-an-ftps-server-in-linux/ 5/5