Set-up ftp server in Ubuntu 12.04 with vsftpd, allow uploads to home folder

It you want a simple ftp server, you can use the great vsftpd.

Now, in my case I wanted to add an additional security feature, which is, to allow users only to access to their home folder and have write permissions to it. This was required for setting up an ftp connection with a webcam uploading images every x amount of time.

First, install vsftpd, but instead of installing the vsftpd version in the Ubuntu 12.04 package, you will need version 3, and this is a bit tricky.

I followed the instructions in this great post: http://blog.thefrontiergroup.com.au/2012/10/making-vsftpd-with-chrooted-users-work-again/. But you need to add a line to avoid this error: sudo: add-apt-repository: command not found.

This line:

sudo apt-get install python-software-properties (following this post: http://rbgeek.wordpress.com/2012/11/18/sudo-add-apt-repository-command-not-found-on-ubuntu-12-04/)

And then the rest:

sudo add-apt-repository ppa:thefrontiergroup/vsftpd
sudo apt-get update
sudo apt-get install vsftpd

So now you will have version 3 of vsftpd installed. And this version allows this configuration line that you have to add:

allow_writeable_chroot=YES

And also uncomment these lines:

local_enable=YES
write_enable=YES

Without version 3, you would be receiving this error: 500 OOPS: vsftpd: refusing to run with writable root inside chroot ()

OK. Now let’s create the webcam user. I followed this tutorial: https://www.digitalocean.com/community/tutorials/how-to-add-and-delete-users-on-ubuntu-12-04-and-centos-6

And then modified the home folder of the webcam user:

sudo usermod -d /desired/upload/folder/path/ webcam

Remember to reload the vsftpd server:

sudo restart vsftpd

And that’s it! write a comment if we can help you further

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s