Set up and secure FTP server on Ubuntu

ftp & ubuntu bannerWhat is FTP and how it works

FTP server is a software used to transfer, upload and download data over the Internet and network. FTP stands for File Transfer Protocol, it is one of the oldest and the most popular method of file exchange. Once the system is working you don’t need to perform many operations to send big or numerous files to another server all over the world. Besides in case of Internet disconnection while you were uploading (or downloading) a file the process will be resumed once the connection is reestablished. Setup FTP server is available for Windows and for Linux as well. The configuration of ftp for Linux distributions differ a little but you still can pick what you need: setting up Ubuntu FTP Server, Fedora or Suse.  But speed is the one of  disadvantages of FTP.

By default FTP server operates on port 21 using TCP. Port 20 performs data transfer. As a rule to connect to FTP server  a username and a password are needed. Sometimes anonymous access is available. When you set up FTP server Ubuntu it can operate in passive and active modes. Which one is used depends on the settings of server and client’s firewalls.

Ubuntu FTP server installation

One of the most used and easy to maintain FTP server for Ubuntu is Pure-FTPd. To configure it you should know how to connect SSH to your server and how to insert commands into terminal.

Lets define which user will be used to start our FTP as. In my case NginX server works as www-data user and I will use this user for my FTP setup. We need NginX and FTP have the same permissions to read and write files.

First thing we should check ID of the user:

You can see that www-data has id 33 , keep in mind that minimal UID for Pure-FTP is 1000, so we should change this value. We nee to edit /etc/pure-ftpd/conf/MinUID and set desired UID. In my case it looks:

When we are done with settings for running as www-data lets create virtual user, you will be prompted to setup a password for the virtual user:

Now we need to create user database:

Please be advices that in some cases you will need to enable Passive mode for your setup. This is a must have option when you are using  AWS, because EC2 instance has internal IP address and you will have issues without this option. Following commands will enable Passive mode for us:

When everything is done, simply restart Pure-FTPd:

FTP server security

To make FTP secure we will have to install TLS support:

Generate private key:

Conclusion

This is not the only method for file transfer. I prefer to use  SFTP server on Ubuntu. In contrast to FTP server SFTP (Secure File Transfer Protocol) provides encrypted data exchange and it uses only one connection between a serves and a client. It eliminates problems with firewalls which occurred in FTP connection.

Thus getting to know all those details about FTP server will broaden your perspective but nevertheless selecting the right server for your business may be time-consuming. ITsyndicate can setup any FTP server Linux properly. Working with us you get understanding why this or that software is the best for your business, you’ll always know what a system administrator is doing and why.

ITsyndicate contact form

Contact us if you have any questions!