Howto install, setup and configure a basic ftp Server on Linux Ubuntu 11.04 using vsftpd service [Linux Server]

by Christian D. H. on July 11th, 2011, updated October 31, 2011
Linux Ubuntu 11.04 SSH OS Operation System Server Apache Web Server FTP

This guide shows Howto install, setup and configure basic ftp Server on Linux Ubuntu 11.04 using vsftpd service.

The Setup is pretty simple. By default Ubuntu uses a package called vsftpd as an FTP server, which is currently the most popular FTP program for Linux systems.
VSFTPD is a GPL licensed FTP server for UNIX systems, including Linux. It is secure and extremely fast. It is stable. Don’t take my word for it, though. Below, we will see evidence supporting all three assertions. We will also see a list of a few important sites which are happily using vsftpd. This demonstrates vsftpd is a mature and trusted solution.

Features
Despite being small for purposes of speed and security, many more complicated FTP setups are achievable with vsftpd! By no means an exclusive list, vsftpd will handle:

  • Virtual IP configurations
  • Virtual users
  • Standalone or inetd operation
  • Powerful per-user configurability
  • Bandwidth throttling
  • Per-source-IP configurability
  • Per-source-IP limits
  • IPv6
  • Encryption support through SSL integration
  • etc…

Installation
Install the vsftpd package. Make sure to make an update before installing to get the latest version:

sudo apt-get update
sudo apt-get install vsftpd

The default configuration for vsftpd is quite secure. Anonymous users are blocked, and no one can write/upload files to the server. Anyone with a system account will be able to connect to the FTP server and download files.

Virtual users?
It is possible to setup vsftp with no user accounts on the Server (virtual users). This is a more advanced setup and not recommended for a setup with few accounts:
How to setup an FTP Server with virtual users(no accounts) using vsftpd on ubuntu

If you want to change any settings, the configuration file for vsftpd is /etc/vsftpd.conf.
Edit the configuration by:

sudo nano /etc/vsftpd.conf

Specify user operations
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 according to their permissions on the Server.

Anonymous Access
Anonymous access is controlled with this directive:

anonymous_enable=NO

This should not be changed if your Server is accessible from the Internet!

Recommended settings
We would also strongly advise to uncomment the following directive in the vsftpd.conf:

#chroot_local_user=YES

to this:

chroot_local_user=YES

This wil resctrict the ftpsecure user to his home directory, otherwise the user will be able to go through the filesystem. This means that any files you want to share through FTP should be placed in this directory.

Individual user access
You may specify an explicit list of local users to chroot() to their home directory. If chroot_local_user is YES, then this list becomes a list of users to NOT chroot().

#chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list

Block users
Too block users from having ftp access you add them to the /etc/ftpusers file and vice versa the opposite.

sudo nano /etc/ftpusers

Activate the settings by restarting the service:
sudo service vsftpd restart

Test
You can then test your FTP service from command line:

ftp 127.0.0.1

The FTP client will ask for your username and password. Then you should see the FTP prompt, which looks like this:

ftp>

If you see that, it’s working. Stop it by writing the command exit.

Subscribe and get more updates on guides, tips & tricks

Leave a Reply

Your email address will not be published.