How To Host An FTP Server On Linux

It’s hard to believe, but in 2017, FTP still remains one of the most reliable ways of transferring large files from one place to another on the internet. Many experts have turned to other solutions (like Syncing/Bittorrent and NFS), but for those looking to transfer data quickly, in an easy and reliable way, an FTP server is still the best way to go. In this tutorial, we’ll show you how to host an FTP server on Linux. We’re going to use a tool called the vsftpd FTP server. There are many background server tools that do what this tool does. If you’re not interested in using vsftpd as your FTP server software, it’s very easy to find a good alternative. That said, vsftpd has a lot of history, and is probably the best one by far.

Installation

Getting vsftpd is fairly easy, as the software is very small. As far as server tools go, this one takes the cake. It’s a small daemon with a configuration file that allows anyone to quickly and easily host an FTP server on their LAN, or over the internet. Best of all, this tool works on pretty much everything. This means if you need a quick and dirty way to transfer data from one server to the other, you can spin up vsftpd on virtually any Linux server distribution.

Additionally, regular PC desktop Linux operating systems carry this server software too, making it possible to quickly run a server directly from your home computer.

Ubuntu

sudo apt install vsftpd

sudo systemctl enable vsftpd

sudo systemctl start vsftpd

Debian

sudo apt install vsftpd

sudo systemctl enable vsftpd

sudo systemctl start vsftpd

Arch Linux

sudo pacman -S vsftpd

sudo systemctl enable vsftpd

sudo systemctl start vsftpd

Fedora

sudo dnf install vsftpd

sudo systemctl enable vsftpd

sudo systemctl start vsftpd

Open SUSE

sudo zypper install vsftpd

sudo systemctl enable vsftpd

sudo systemctl start vsftpd

Other

The vsftpd tool is a service that allows any Linux server (or PC) to keep and host an FTP server. The FTP protocol, despite being very old is still very much in use today so the vsftpd tool is found on pretty much all of the major Linux distributions for PC and server.

To get it for your Linux distribution, open your terminal and search your package manager for “vsftpd”, or “FTP server” . You should also try out other FTP hosting tools if your Linux-based operating system doesn’t have it vsftpd.

Configuration

After installing vsftpd, and enabling it with systemd, the service is running. However, the FTP server itself will not work unless it is configured. To do this, we must open the vsftpd configuration file in a text editor, and add some things. In the terminal, open the text editor.

sudo nano /etc/vsftpd.conf

By default, anonymous connections are allowed. This means that users, no matter who they are can easily connect and use your FTP server. To make things easy, leave this option enabled. If not, add a # in front of “anonymous_enable=YES” to disable this setting.

Next, use the arrow keys to scroll down. Look for “write_enable=YES”, and “anon_upload_enable=YES”. Enable these settings by removing the # from in front of it.

Further down the configuration file, there is a security setting that should be enabled. This setting forces the FTP server to run on its own user, and strips it of root privileges. This means if anyone hacks your FTP server, they will not be able to mess with your entire Linux server, or PC. To be clear, vsftpd can run without this setting, but we do not recommend it.

To enable this security setting, find “nopriv_user=ftpsecure“, and remove the # sign.

When all of these settings are enabled, restart vsftpd with the systemd init system:

sudo systemctl restart vsftpd

Connect to the server by going to the address bar of your Linux file manager and entering:

ftp://local.ip.address

Note: don’t want to use a file manager? Try FileZilla instead.

You can also use the hostname, such as

ftp://ubuntu-server

and etc.

To find your server’s IP, do ifconfig and then enter the IP address the command returns (under IPv4). Alternatively, do:

ping hostname

Then, write down the IP ping finds.

SSH SFTP

Can’t get this vsftpd tool running? Too complicated? There is another way! Install SSH, and use the built in SFTP tool. The SSH protocol can host a secure FTP server on demand. There are benefits to this, such as getting a quick file-transfer server in an instant. However, there are also major drawbacks, such as a slower transfer rate. Traditional FTP, though not as secure isn’t bogged down by encryption rules, and as a result users can transfer files very quickly.

SFTP will get users out of a tight spot for sure, but there’s no replacement for FTP, even in 2017. Want to learn how to get the SFTP/SSH protocol working? Head over here to learn more!

Conclusion

Despite it’s age, FTP still proves to be a reliable tool. Few other transfer protocols are as reliable when transferring data quickly and easily over a network. Whether you’re just trying to move a few files to your web server, or deliver a few photos to some friends, the file transfer protocol still proves it has its uses.

Source