In this tutorial, I will explain to you how to set up your FTP server. But first, let me quickly tell you what is FTP.
What is FTP?
FTP is an acronym for File Transfer Protocol. As the name suggests, FTP is used to transfer files between computers on a network. You can use FTP to exchange files between computer accounts, transfer files between an account and a desktop computer, or access online software archives. Keep in mind, however, that many FTP sites are heavily used and require several attempts before connecting.
An FTP address looks a lot like an HTTP or website address except it uses the prefix ftp:// instead of http://.
FTP Server? How to set it up?
Typically, a computer with an FTP address is dedicated to receive an FTP connection. A computer dedicated to receiving an FTP connection is referred to as an FTP server or FTP site.
Now, let’s begin a special adventure. We will make FTP server to share files with friends and family. I will use vsftpd for this purpose.
VSFTPD is an FTP server software which claims to be the most secure FTP software. In fact, the first two letters in VSFTPD, stand for “very secure”. The software was built around the vulnerabilities of the FTP protocol.
Nevertheless, you should always remember that there are better solutions for secure transfer and management of files such as SFTP (uses OpenSSH). The FTP protocol is particularly useful for sharing non-sensitive data and is very reliable at that.
Step 1: Installing VSFTPD in Linux
You can quickly install VSFTPD on your Fedora/Red Hat/SUSE servers through the command line interface with:
dnf -y install vsftpd
If you are using Ubuntu/Debian-based distributions, you can install VSFTPD using this command:
sudo apt-get install vsftpd
If you are using Arch-based distributions, try this command for installing VSFTPD.
sudo pacman -S vsftpd
Step 2: Configuring FTP server
Most VSFTPD’s configuration takes place in /etc/vsftpd.conf. The file itself is well-documented, so this section only highlights some important changes you may want to make. For all available options and basic documentation see the man pages:
Files are served by default from /srv/ftp as per the Filesystem Hierarchy Standard.
Enable Uploading to the FTP server:
The “write_enable” flag must be set to YES in order to allow changes to the filesystem, such as uploading:
Allow Local Users to Login:
In order to allow users in /etc/passwd to login, the “local_enable” directive must look like this:
The following lines control whether anonymous users can login:
# Allow anonymous login
# No password is required for an anonymous login (Optional)
# Maximum transfer rate for an anonymous client in Bytes/second (Optional)
# Directory to be used for an anonymous login (Optional)
It is possible to set up a chroot environment, which prevents the user from leaving his home directory. To enable this, add/change the following lines in the configuration file:
The “chroot_list_file” variable specifies the file in which the jailed users are contained to.
Step 4: Restart your FTP server
In the end you must restart your ftp server. Type in your command line
sudo systemctl restart vsftpd
That’s it. Your FTP server on Linux is up and running. FTP is increasingly being replaced by FTP over SSH protocol so you may want to setup SFTP server on Linux.
Any questions or suggestions is always welcomed.
Ali is a computer programmer and passionate about Linux. He uses Trisquel Linux and at times blogs about it. And he does all this using Orca screen reader program because he cannot see.