Basic FTP Server Setup with vsftpd on Ubuntu 11.04 Natty Narwhal

It’s pretty simple to install and to a basic configuration of an FTP server on Ubuntu 11.04 Natty Narwhal. By default Ubuntu uses a package called vsftpd as an FTP server, which is currently the most popular FTP package for Linux systems. To install the vsftpd package, use the following command at the Terminal:

sudo apt-get install vsftpd

Follow the default prompts, and the vsftpd server will be installed on your computer. Generally, the default configuration for vsftpd is pretty secure, and good enough for casual use. Anonymous users are blocked, and no one can write files to the server (or, in FTP terminology, no one can upload files to the server). Anyone with a system account will be able to connect to the FTP server and download, though not upload, files.

If you want to change any settings, the configuration file for vsftpd is /etc/vsftpd.conf. Like any other configuration file, you can edit it with vi:

sudo vi /etc/vsftpd.conf

(If you’re using the desktop version of Ubuntu, you can of course use the graphical gedit editor.)

The vsftpd.conf file contains a large number of “directives” that govern how the server behaves and operates. If you want to change its configuration, you’ll need to alter the directives.

If you want users to be able to write files to your FTP server, change this directive:

#write_enable=YES

To this:

write_enable=YES

With the write_enable directive set to YES, users will be able to upload files to your FTP server. Note, however, that they will only be able to do so if they have proper permissions to the directories in question. They’ll be able to upload files to their home directories, but not, for instance /var or /usr.

Anonymous access is controlled with this directive:

anonymous_enable=NO

Under no circumstances should you allow anonymous access to your FTP server, especially if it is accessible from the Internet! There are certain circumstances when you might find it useful, but you should only enable it if you know exactly what you are doing. Generally, it is almost always best to keep anonymous_enable set to NO.

If you make any changes to the file, switch vi to command mode, save the changes, and then exit vi. Then restart the vsftpd server so it reads its new directives:

sudo service vsftpd restart

You can then test your Ubuntu machine’s FTP service from the server’s command line:

ftp 127.0.0.1

The FTP client will ask for your username. Enter that, and then the client will ask for your password. Enter that as well, and you should then see the FTP prompt, which looks like this:

ftp>

If you see that, you know the server is working. You can return to the regular command line with this command:

exit

 

USING THE FTP CLIENT

Just because you have an FTP server doesn’t mean you can access it straightaway – you first need a program called an “FTP client” that will let you communicate with the FTP server. Fortunately, Ubuntu comes with a built-in FTP client – you can access it from the command line by simply typing:

ftp

However, it’s far easier to use if you know the IP address of the FTP server you want to access. Let’s say you want to access a FTP server with an IP address of 192.168.1.100. To do so, you would append the IP address to the ftp client command:

ftp 192.168.1.100

The FTP client will then ask for your username. (Note that this will be your username and password on the FTP server, not the computer with the FTP client.) Type it and hit enter. The client will ask for your password, which you should then enter. Once you do, you’ll be taken to the FTP prompt, which looks like this:

ftp>

You can also specify a different username as part of the ftp command. If, for instance, you wanted to use our camalas account to connect to the FTP server at 192.168.1.100, the command would look like this:

ftp camalas@192.168.1.100

Once at the FTP prompt, you can use some of the common terminal commands. To see a listing of the remote directory, you can use the reliable ls command:

ls

This will display the contents of the remote directory.

To find which remote directory you’re actually in, you can use the pwd command:

pwd

This command stands for “print working directory”, and will display the current working directory.

To download files from the FTP server, you will need to use the get command. For instance, to retrieve a file named “report.doc” from the current working directory:

get report.doc

This will download the file to your local home directory.

ADDITIONAL READING:

The Ubuntu Beginner’s Guide

The Ubuntu Desktop Beginner’s Guide.

This entry was posted in Ubuntu 11.04. Bookmark the permalink.

14 Responses to Basic FTP Server Setup with vsftpd on Ubuntu 11.04 Natty Narwhal

  1. Pingback: Basic FTP Server Setup with vsftpd on Ubuntu 11.04 Natty Narwhal … | DriveTap

  2. Socialism says:

    Jonathan, you’re a frickin’ godsend. And I’m not even religious. Thanks.

  3. Jonathan Moeller says:

    Glad it helped!

    Now go buy one of my books. :)

  4. Troy says:

    Thanks buddy, very easy instructions. Uploading my weather station data to my webserver periodically now, cheers.

  5. James L says:

    Thanks so much that really really helped me out as a new ubuntu user :) previously used to windows filezilla server and client

    So thanks, no have access to my system :)

    James

  6. Jonathan Moeller says:

    Glad it came in handy!

  7. Pingback: Ubuntu: What I do after install « Binary Delusions

  8. RustanTech says:

    Nice tutorial dude! It helps me a lot. But next time better include local permissions and access control configurations. Just a thought ^_^

  9. Pingback: Ubuntu 11.10: What I do after Install « Binary Delusions

  10. Pingback: Rackspace Cloud LEMP Ubuntu 11.04 Server | | NoConformityNoConformity

  11. gourish says:

    I installed ftp in ubuntu.and its installed successfully but the thing is when I acceaa from the client it is asking for me user name and password.If put username and password its showing me 530 login incorrect.Please help me out.it would be small issue that I am not getting,

  12. Daniel says:

    Great, thanks!

  13. Chris says:

    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

    http://wilson18.com/how-to/linux-networking/how-to-add-ftp-accounts-for-your-hosted-sites/

  14. ruvan says:

    straight and to the point!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>