What 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 other servers 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 re-established. Setup FTP server is available for Windows and for Linux as well. The configuration of FTP for Linux distributions differs 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 an 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 the 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 a terminal.

apt-get update
apt-get install pure-ftpd

Let's define which user will be used to start our FTP as. In my case, the Nginx server works as www-data user and I will use this user for my FTP setup. We need Nginx and FTP to have the same permissions to read and write files.
The first thing we should check ID of the user:

id www-data
uid=33(www-data) gid=33(www-data) groups=33(www-data)

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

cat /etc/pure-ftpd/conf/MinUID
33

When we are done with settings for running as www-data let's create virtual user, you will be prompted to set up a password for the virtual user:

pure-pw useradd joe -u www-data -d /var/www/wp-lab.itsyndicate.org

Now we need to create a user database:

pure-pw mkdb

ln -s /etc/pure-ftpd/pureftpd.passwd /etc/pureftpd.passwd

ln -s /etc/pure-ftpd/pureftpd.pdb /etc/pureftpd.pdb

ln -s /etc/pure-ftpd/conf/PureDB /etc/pure-ftpd/auth/PureDB

Please be advised 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 instances have an internal IP address and you will have issues without this option. Following commands will enable Passive mode for us:

cd /etc/pure-ftpd/conf
sudo bash -c 'echo "35000 36000" > PassivePortRange'
sudo bash -c 'echo "&LTyour-server-ip>" > ForcePassiveIP'
sudo bash -c 'echo "yes" > DontResolve'

When everything is done, simply restart Pure-FTPd:

service pure-ftpd restart

FTP server security

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

apt-get install openssl

echo 2 > /etc/pure-ftpd/conf/TLS

Generate private key:

openssl req -x509 -nodes -days 7300 -newkey rsa:2048 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem

chmod 600 /etc/ssl/private/pure-ftpd.pem

service pure-ftpd restart

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 serves and a client. It eliminates problems with firewalls that occurred in FTP connection.
Thus getting to know all those details about FTP servers will broaden your perspective but nevertheless selecting the right server for your business may be time-consuming. ITsyndicate can set up any FTP server Linux properly. Working with us you get an understanding of why this or that software is the best for your business, you’ll always know what a system administrator is doing and why.

Request more information today
Discover how our services can benefit your business. Leave your contact information and our team will reach out to provide you with detailed information tailored to your specific needs. Take the next step towards achieving your business goals.
Contact form:
Our latest news