How to Share Files Between Linux Systems

In today’s world, most of us have more than one computer device in the house. There is often at least one desktop PC and several laptops connected to the home network. And more recently, tablet computers have been introduced to our networks. Setting up internet access on all these devices is usually a pretty easy and standard task. But when it comes to sharing files between devices, things can become a little more difficult and often require a little more technical knowledge.

It is true that there are cloud options which have flooded the market, such as Dropbox. But cloud options require you to be connected to the internet at all times and use your internet connection bandwidth for file synchronization and transfers. That can often be time consuming when you’re dealing with large media files and directories. And of you’re on a budget internet plan, it could also be costly due to the bandwidth being used for the file transfer(s).

One of the oldest forms of transferring files between computer systems is using the FTP (File Transfer Protocol) method. The method of FTP was originally developed in the early 1970’s. Although today’s revisions are slightly improved from that of the original protocol, the concept is basically the same. And despite its age, FTP has aged gracefully and is still relied upon today from enterprise, universities and many businesses around the world.

For today’s How To, I’ll show you how you can share your own computers files with other computers on your home network and also the internet. So regardless of where you are or what device you’re accessing from, you can have full access to all your own files at all times.

The first thing we’ll need to to is install the required package to get the job done. The package is vsftpd. That’s the actual FTP server daemon required to run for other computers to access the computer running the FTP server. And this can be installed using the following command in a terminal:

sudo apt-get install vsftpd

Once the package is downloaded and installed, we need to make a few simple changes to the vsftpd configuration file which is located at /etc/vsftpd.conf

To make the required changes, the easiest way is via your terminal by using the following command:

sudo nano /etc/vsftpd.conf

The first thing we need to do is secure the FTP server access from any incoming Anonymous connection attempts. Scroll down to the section of the configuration file and ensure the following setting looks like this:

anonymous_enable=NO

And now we need to allow local access for the FTP server. Scroll down to the section of the configuration file and ensure the following setting looks like this:

local_enable=YES

Now just save and exit the nano editor.

Before we actually have access to the FTP server, we must make a few easy changes to the firewall to actually allow for other computers to access the FTP server. If you’re using Ubuntu, then chances are you’re probably using ufw for your system firewall. All you need to do to allow access to the FTP server is type in the following command in to your terminal:

sudo ufw enable

This will ensure the firewall is active and running at system startup. Now type the following:

sudo ufw allow 21

This will open port 21 in the firewall to allow for access to the FTP server. If you do not open this port, other computers will not be able to access your FTP server.

Now that we’ve enabled access via software firewall, we must also enable access via your home network router so that you can access the FTP server over the internet. This will vary depending on your router, so you may have to refer to the router manual to perform these changes.

You need to open port 21 in your router’s firewall and port forward port 21 (FTP) requests to the FTP server’s local IP address. In this instance, the local IP address I am using is 192.168.0.2. But this will vary for every home network.

So now that we’ve installed the FTP server, configured the settings for access and enabled access via both the software and hardware firewall, it’s now time to see whether our FTP server works. If you have followed the above instructions step-by-step, then everything should work correctly. If for some reason you can not connect to the server, the most likely issue will be your firewall settings. Be sure to check over the settings again and ensure you have configured them correctly.

For some simple testing, we need to jump on to a different computer system. For our test, we will boot up Nautilus File Manager as it has built in support for FTP access and other methods of server access. But if you prefer to use a different FTP client, then I’d recommend you give Filezilla a try as it’s an excellent standalone FTP client.

Launch Nautilus and go to File > Connect to Server. And for Service type, change the option to FTP (with login). In the server setting, you’ll need to type the IP address of the computer we just set up the FTP server on. For this test, I used the local IP 192.168.0.2, but use whatever your own system is using. And also remember, if you are accessing your FTP server over the internet, you need to enter the IP address of the internet connection and not the local IP address. Once you’ve typed in the correct IP address for the server, we need to enter Port 21 for access. In the folder setting, just type in home. And upon login to the FTP server, it will take you directly the /home directory of the file system. And the Username setting is pretty obvious, just type your username to login to the FTP server. Once all of the information is entered, just click Connect and Nautilus should now connect to the FTP server. It will prompt you for your password. Once you enter your password, Nautilus will open up the FTP server directory just like any other local directory on the system. And you should now have full access to your server via FTP.

For security reasons, we did not allow write support via FTP for this How To. But you can Copy any file on the system using FTP. Once you have finished copying your files, you should always close the connection. In Nautilus, this is done exactly the same as unmounting any other removable drive/media. On the left-hand side pane, you will see an eject icon, click this and Nautilus will disconnect from the FTP server.

That’s it. You now have a full functioning FTP server running on your network which can be accessed via any other computer on your home network or over the internet.

Generally speaking, FTP is a rather safe method for transferring files between computer systems for general files that home users will be transferring. Some experts warn of the concerns in the way that FTP transmits passwords. Don’t worry, if you are the security conscious type (which is not a bad thing), that’s fine because we also have that base covered with a How To Share Files Between Linux Systems via SSH, using the very secure SSH protocol. You can check out that “How To” in the coming weeks.