Introduction

If you’re interested in learning about networking, or if you have files that you would like to share with the world at large, then at some point you’re probably going to want to get an FTP server running on a machine. There is a vast array of options for a server, depending on what operating system your server is running and how much work you want to put in to setting it up. Read on for instructions on how to get free FTP servers up and running quickly using Linux, Mac, or Windows. All of the software mentioned here is free; paid FTP server programs do exist, but almost anything you need to do with an FTP server can be done with an open-source program.

Prerequisites

  • Ensure your firewall allows TCP traffic in on port 21 (if you are only using localhost to test an FTP server out, then this firewall requirement is unnecessary).

Running an FTP server on Linux

If you’re using a Linux machine, installing a free FTP daemon, vsftpd, is a very simple process.

On a Debian-based system (Ubuntu, Debian, etc.), in a terminal window, enter:

sudo apt-get install vsftpd

Enter ‘y’ to any necessary dependencies and allow the installation process to complete.

On a Red Hat/CentOS system, enter:

sudo yum install vsftpd

Enter ‘y’ to any necessary dependencies and allow the installation process to complete.

After the download and install process finishes, vsftpd starts, but its default settings do not allow uploads or directory editing. You’ll most likely want to allow this activity, particularly if you’re using the server to test your own code. To enable file editing and uploads, we need to enable them in the server configuration files. Open vsftpd.conf in a text editor.

Debian/Ubuntu:

sudo nano /etc/vsftpd.conf

CentOS/Red Hat:

sudo nano /etc/vsftpd/vsftpd.conf

Once inside, you will need change a couple of things. Below are the ones to change and why we will be changing them.

anonymous_enable=NO

This will disable the ability for users to login anonymously

local_enable=YES

Since we disabled anonymous logins, we need to enable user logins that use the local authentication files.

write_enable=YES

This will enable users to make changes to the filesystem.

chroot_local_user=YES

This will restrict users to have access only to their home directories.

After you make this change, save the file and quit. Then, restart the daemon:

sudo service vsftpd restart

To test your server, open a terminal window and enter

ftp localhost

You should be greeted with the ftp login (the username and password credentials will be same as your server credentials):

Connected to localhost.  
220 ProFTPD 1.3.4a Server (Debian) [::ffff:127.0.0.1]  
Name (localhost:wolf): wolf  
331 Password required for wolf  
Password:  
230 User wolf logged in  
Remote system type is UNIX  
Using binary mode to transfer files.  
ftp>

You’ll now have an FTP server running on your local machine. If you allow it access to the Internet (by enabling port forwarding on your router or firewall) it can act as a normal FTP server. If you merely keep it running as a local service, you can use it to test code and connections.

Adding FTP User

Next, we have to create an FTP user. I will use the user “atlantic” in this example but you can use any username. To add a user, run the following command.

adduser atlantic

Enter a password for the user and fill the rest out if you would like. You can also press enter through the rest.

You must provide root ownership to the users home directory now.

chown root:root /home/atlantic

Next, for the user to be able to upload files, we need to create a directory under their home directory.

mkdir /home/atlantic/folder

Then provide the user this directory.

chown atlantic:atlantic /home/atlantic/folder

Now this user is set up to log in and upload files to their folder directory.
.

Running an FTP server on Mac

The Mac offers several options for running an FTP server. Probably the easiest option is to use the built-in server in OS X. It’s a bit hard to find in more recent versions of the OS, but it is still there and is fully functional.

To start it, open a terminal window on your Mac (Applications > Utilities > Terminal). Enter the following command to start the server:

sudo -s launchctl load -w /System/Library/LaunchDaemons/ftp.plist

That’s all there is to it! To make sure it worked, in your terminal window enter

ftp localhost

You should be greeted with the FTP login:

Trying ::1...  
Connected to localhost.  
220 ::1 FTP server (tnftpd 20100324+GSSAPI) ready.  
Name (localhost:wolframdonat):

You now have an FTP server running on your Mac! You can use your usual account name and password to access your files from another computer, or just test code you write.
.

Running an FTP server on Windows

By far the easiest program to use as an FTP server on a Windows machine is FileZilla. It’s free, and both a client and server option are available.

To get started, download the server from Filezilla’s site. Make sure you choose the correct option for your particular version of Windows and download the Installer Setup program from SourceForge. Double-click to start the installer, and accept all of the default options during the install:

  • Standard install
  • In the default location
  • Installed as a service that starts with Windows

When it’s finished installing, restart your computer, and the FileZilla server should start up automatically. The first time it starts, you’ll need to add a user (it doesn’t just recognize the user accounts on your computer.) From the ‘FileZilla Server’ window, click Edit > Users, and then add a user and password. You’ll also need to set a home directory for that user (the C:\ drive should be fine).

When you’ve created a user and password, you can test the setup. Start a command prompt, and in the terminal window, enter ftp localhost. You should see something like the following:

Connected to _your computer name_.  
220-FileZilla Server 0.9.54 beta  
220-written by Tim Kosse ([email protected])  
220 Please visit https://filezilla-project.org/  
User (_your computer name_:(none)):  

Enter the username and password here that you just created, and you should get an ftp prompt:

230 Logged on  
ftp>

Congratulations! You now have an FTP server running on your Windows machine! You can use the user/password you just created to test any code you write, or you can log in from another computer using any FTP client. Remember that if you are accessing your machine from outside your network, you’ll need to set up port forwarding on your router or firewall.
.

Conclusion

Setting up an FTP server is not difficult. It’s a skill that comes in handy if you need to share files quickly and easily with other computers, either on your home network or the internet. See some of our other articles here, and check out our reliable dedicated server hosting solutions. Thanks for reading!