How to Share files with vsftpd ftp server on Linux

July 5, 2007 at 2:38 pm | Posted in ftp, Linux, vsftpd | 1 Comment

Vsftpd is the most easy ftp server to setup.

Installing vsftpd:

On Ubuntu: sudo apt-get install vsftpd
On Fedora: (as root) yum install vsftpd

The configuration file for vsftpd is located in /etc/vsftpd.conf. The default configuration is a little bit paranoid, not so usable for file sharing. So use this configuration instead:

# Put in /etc/vsftpd.conf
# Don’t forget to change samurai into your local username
ftpd_banner=Welcome to blah FTP service.

Don’t forget to backup before you use this configuration.

sudo cp /etc/vsftpd.conf /root/

Now we must make writable directory for anonymous user.

cd /home/ftp
sudo mkdir opendir
sudo chmod 777 opendir/

Ok, I explain this. In my local system, I have user named ‘samurai’. With this configuration, I can log into ftp server with local user, that is ‘samurai’. ‘samurai’ can go anywhere, create files, delete files, etc as long as he has sufficient permission.

With this configuration I can log into ftp server with anonymous user ( without username and password ). After logging in, the anonymous user jailed in /home/ftp directory ( pointed by anon_root ). I can’t go outside. I can download files from /home/ftp directory but not create, delete anything from this directory. But I can write and delete files in opendir. If I write files in opendir or upload files in opendir, the files automatically belong to ‘samurai’ user.

To run this server:

sudo /etc/init.d/vsftpd start

To stop it:

sudo /etc/init.d/vsftpd stop

To restart it:

sudo /etc/init.d/vsftpd restart

Now it is usable for file sharing


1 Comment »

RSS feed for comments on this post. TrackBack URI

  1. I recently set this up to rid myself of the need for Samba at home. I had some trouble with symbolic links (apparently vsftpd doesnt support following them, or at least keeps them very secure).

    I wanted to have a single ftp directory with links to the different folders I wanted to share, so I used bind mounts. So, in my folder /home/myusername/sharedftp, I wanted to have a link to /media/storage/videos. I added this line to the end of /etc/fstab (remember, fstab is loaded sequentially, so these lines must come *after* the line for mounting /media/storage):

    /media/storage/videos /home/myusername/sharedftp/videos bind 0 0

    Now, when I boot up, my storage drive is mounted (/media/storage) then my videos directory (/media/storage/videos) is mounted a second time within the larger file system for use by ftp users (/home/myusername/sharedftp/videos).

    Hope this helps anyone who gets here from Google like I did šŸ˜‰

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at
Entries and comments feeds.

%d bloggers like this: