How to setup vsftpd FTP on Ubuntu Linux

vsftpd is a GPL licensed FTP server for UNIX systems, including Linux. It is secure and extremely fast.
Using this instructions, you can set up vsftpd on variuos linux distros. This tutorial will show you how to set up your own ftp in Ubuntu Linux.

1. Install vsftpd

2. Change the configurations file
Open the vsftpd.conf configuration file with a text editor. The file is located in the /etc directory.

Once you are editing the file, you’ll want to make a few changes. Change this:

To this:

This will disallow anonymous access to your FTP server. Unless you have a really good reason for permitting anonymous access, and you know what you’re doing in terms of network security, I’d recommend leaving the anonymous access off. Especially if your Ubuntu FTP server is sitting on the Internet.

Of course, with anonymous access off, you’ll need to permit local users to log in. Do this by changing this directive:

To this:

(Putting a # in front of a line disables it; this is called “commenting it out”.)

3. Adding a “fake” shell
Edit the /etc/shells file and add a non-existent shell name like /bin/false, for example. This fake shell will limit access on the system for FTP users.

/bin/false is our added no-existent shell. With Red Hat Linux, a special device name /dev/null exists for purposes such as these.

4. Setup an FTP user account
It’s important to give to your strictly FTP users no real shell account on the Linux system. In this manner, if for any reasons someone could successfully get out of the FTP chrooted environment, it would not have the possibility of executing any user tasks since it doesn’t have a bash shell. First, create new users for this purpose.
This has to be separate from a regular user account with unlimited access because of how the chroot environment works. Chroot makes it appear from the user’s perspective as if the level of the file system you’ve placed them in is the top level of the file system.
Use the following command to create users in the /etc/passwd file. This step must be done for each additional new user you allow to access your FTP server.

– The mkdir command will create the ftp/ftpuser directory under the /home directory to handle all FTP users’ home directories we’ll have on the server.
– The useradd command will add the new user named ftpuser to our Linux server.
– Finally, the passwd command will set the password for this user ftpuser.

Once you’ve made these changes, restart the vsftpd service with this command:

5. Override config option specified in the manual page, on a per-user basis (optional)
If you want to make custom changes in the behaviour of the ftp server on a per-user basis, you should know that vsftpd has a powerful option that allows you to do this.
If you set user_config_dir to be /etc/vsftpd_user_conf and then log on as the user “chris”, then vsftpd will apply the settings in the file /etc/vsftpd_user_conf/chris for the duration of the session. The format of this file is detailed in the manual!
Please note that not all settings are effective on a per-user basis. For example, many settings only prior to the user’s session being started. Examples of settings which will not affect any behviour on a per-user basis include listen_address, banner_file, max_per_ip, max_clients, xferlog_file, etc.

Leave a comment ?

18 Comments.

  1. I’m sick of all these stupid blogs. You didn’t post anything new. All you did is make a post so search engines would find your stupid website. Come on, do something unique. Write a detailed howto. Put some effort into it, you and all the other bloggers too.

  2. My friend, it’s your choice if you read this blog or not. I write things here not because I want search engines to find my “stupid website”, but because someone would find the information useful.

  3. Hello, I have found this post useful, but I am a complete Linux/Ubuntu newb trying to learn how to get around. After I get vsftpd installed and configured and the ftpuser set up, what should I play around with next? I don’t even know how to connect to my ftp server and upload stuff and i’m having trouble finding useful information on such basic details. Any more information would be helpful, thanks!

  4. Nice, detailed, useful post. I caught one error, though:

    sudo /etc/init.d/vsftp restart

    should be

    sudo /etc/init.d/vsftpd restart

  5. Thanks, I made the correction.

  6. This post was helpful to me, don’t get discourage by the negative comments of people that don’t realize that there are still others who are new to Linux and to the installation and configuration of the different types of servers.

    Thanks!

  7. thanks, it was very useful for me

  8. jomar.angelfish

    thank you very much for your post. your post is very useful in setting my ftp server. in case you have time, please post about setting up a proftpd in ubuntu. cheers! thanks.

  9. This post was very helpful. I now want to copy some files to this ftp directory and send the link across the world to my friend who can copy and download the files from a Microsoft windows system. How can I do this? What link can I send across?

  10. I agree with many here. This was well written and explained. Many other parallel howto’s just list commands and don’t explain anything. That’s what newbies like me need.
    Please continue to write these, I’ll bookmark this and use it 😉

  11. Quirky VSFTPD.CONF - cannot jail users - pingback on April 4, 2013 at 10:21 pm
  12. This information has to be in some place. I found it here, it was usefull and saved me some time. I’ve bookmarked it for latter refference. Rgds. 😀

  13. Hi cviorel, What you have mentioned here has been useful to me – thanks a ton.
    George

  14. Authentication failure for FTP server - Tech Forum Network - pingback on April 4, 2014 at 8:32 am
  15. 😆 nice post, but one issue. i don’t have any symlink for vsftpd in my /etc/init.d folder. also if i directly try
    sudo /usr/sbin/vsftpd restart it starts looking for “restart” file ?? any idea ?

  16. On recent distributions you may try running sudo service vsftpd restart.

  17. Don’t mind the Troll. Your info was absolutely fine with (not that newie but not that pro) me. Well explained and concise.

    Congrats man. Keep on the good work.

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

This site uses Akismet to reduce spam. Learn how your comment data is processed.