Add ftp service to your Ubuntu Server - gHacks Tech News

Add ftp service to your Ubuntu Server

So you now have your Ubuntu Server up and running with the help of "Installing Ubuntu Server 9.04" and you now have Samba working with the help of "Set up your new Ubuntu Server as a Samba Server". Now it's time to add ftp to the mix. Of course many people are of the mind set that FTP servers are slowly becoming a thing of the past. I would disagree because of the low cost of hardware, ease of set up, and ease of use. You can't beat an FTP server up on your network as a central file repository.

Now that you already have your Ubuntu Server up and running, adding FTP is actually quite easy. There are numerous FTP servers available, but the one I tend to prefer is vsftpd. Not only is it more secure than many other FTP servers, it's easy to install and configure, even for anonymous use.

In this article you will see how to get vsftpd installed and configured for both user login and anonymous use.

Installing vsftpd

Since the installation for the base server is a GUI-less Ubuntu 9.04, the entire installation and configuration will be done from the command line. Log into your server and then issue the following command:

sudo apt-get install vsftpd

The above command will install everything needed for your FTP server. What you will find is your configuration file located in the /etc directory and the executable located in /etc/init.d/. By default vsftpd is installed to allow ONLY anonymous download. The default location for anonymous files is in /home/ftp. So by default all you need to do is place files you want to be accessible anonymously in /home/ftp, start the vsftp daemon with the command:

sudo /etc/init.d/vsftpd start

And you can immediately connect anonymously. Any file located within /home/ftp will be available to anonymous users. That's not a bad setup for an internal LAN. But if you need to control what people use/see, or if you do not want to allow anonymous access, you will have to take care of a little configuration.

Configuring user-authenticated login

Let's say you have four users on your system that need access to their own individual accounts. For this you will need to enable user-authenticated login. This is done within the /etc/vsftpd.conf file. Open up this file and scroll down to around line 26. Here you will see the entry:


Notice the "#" symbol at the beginning of the line? This means that line is commented out. Remove the "#" symbol, save the file, restart vsftpd, and now anyone with an account on your ftp server can log in with their username and password.

But what if the users need to upload as well as download? Simple. Below the local_enable line you will see the line:


Uncomment out that line and restart vsftpd to enable write access for your users. Remember, you have to restart vsftpd any time you make a change to the configuration file. You can also disable anonymous access by commenting out the line:


This can be handy for departments as well. Say you have an editorial department, a graphics department, and an accounting department. You will have to have those accounts added to the system. You can add those accounts (and their home directories) with these commands:

sudo useradd -m ACCOUNT_NAME

sudo passwd ACCOUNT_NAME

Where ACCOUNT_NAME is the name of the user account to create. The above commands will create the user, the users' home directory, and give the user a password.

Once these accounts have been created you can log into the FTP server with the username and password.

Final thoughts

Setting up an FTP server couldn't be any easier. With the Ubuntu Server already up and running, you can have anonymous ftp set up in about a minute.

  • We need your help

    Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.

    We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats (video ads) or subscription fees.

    If you like our content, and would like to help, please consider making a contribution:


    1. said on September 6, 2009 at 9:26 am

      What if the machine is on dynamic ip?

    2. Ray said on March 2, 2010 at 7:50 am

      What could be the reason the server is letting the user go higher that its own home directory? How to prevent this to happen.


      1. DarkWulf said on March 8, 2010 at 5:48 pm

        Just add


        to /etc/vsftpd.conf
        then users are locked to theyre homedirs.

    3. blah said on May 12, 2011 at 6:23 pm

      what if the file to write in the vsftpd.conf always pops up as write only how do i change this?

    4. christopher wilson said on September 23, 2012 at 1:00 am

      Hi, Im not sure if this would help you or not but I have written a guide about how you can do this with pureftp on ubuntu server 12.04. You can set up different accounts which you can manage through mysql. As i said, im not sure if this is you wanted but I hope it helps

    Leave a Reply