Debian – Create FTP accounts with access to just some folders in the web directory

apache-2.2debianftpvps

I own a VPS server. At the moment I havent installed any FTP server on it, I am using SSH and SFTP only. I am using Debian 6 Squeeze and Apache2 service. The web directory is in /var/www/

Well, I wanted to create different FTP accounts and give access to some people to them (one account per user). In my web directory I have an structure like this:

/var/www/mtaplugins/music/mplayer/music/
/var/www/mapuploader/
and more folders inside. I want to create an FTP account which should be able to just access one of those folders and the folders inside them.

I would appreciate some recomendations or stept to follow before installing anything or doing anythong, because I dont have any idea about this.

I was thinking in using ProFTPd but as I saw in the documentation it would just create an account for each user in my server, and I want to not create more users (I always use root)

Thanks in advance

Best Answer

In this situation, you may install vsftpd and make settings that allow access via ftp for system users to his home directory that will be /var/www/mapuploader/USER1, /var/www/mapuploader/USER2, /var/www/mapuploader/USERN.

So. For Example:

useradd -d /var/www/mapuploader/userN -m -s /bin/bash userN

After this step you'll have a user acoount with the home dir as /var/www/mapuploader/user1, but you need to set the password for this user:

passwd userN

Ans type and re-type the new password, that you should use later to login via ftp. Now install vsftpd

apt-get install vsftpd

And add some changes to the default config file

nano /etc/vsftpd.conf

There you need to set some values for several variables:

anonymous_enable=NO

local_enable=YES

write_enable=YES

local_umask=022

chroot_local_user=YES

And the other variables do not touch. Save changes.

Now you need to restart vsftd to re-read the config file:

/etc/init.d/vsftpd restart

Now your system users can access your home directory via ftp.