Ubuntu – How to setup VSFTPD for multiple users including adding specific directories

ftp

I wish to configure vsftpd in 11.10 so that when a user connects he is shown or redirected to a specific folder. The name of the folder is not related to the user or home folder. It is related to a folder in /var/www. For example:

If user cyrex logs in ftp he is redirected to /var/www/gamers or at least shown a gamers folder inside his home folder that redirects to /var/gamers.
If user camelot logs in ftp he is redirected to /var/www/food or at least shown a food folder inside his home folder that redirects to /var/food.

The thing he should not leave his home folder and can only access folders inside his home folder that are redirected to other parts like the /var/www/FOLDERS.

UPDATE: In one way of configuration the user should see his home folder and also a folder that redirects him to /var/www/UserFolder. In another way of configuring VSFTPD the user should just be redirected to /var/www/UserFolder without even seeing his home folder, just the var/www specific to him. Can both methods be shown in one answer so I can test both to see which one is better.

What is the easier way to do this.

Best Answer

You just have to modify the startup call for vsftpd. The user_config_dir argument will tell the server to look for a configuration in the directory /etc/vsftpd_user_conf/luis if the user luis logs in. Analogously with any other user that logs in. I guess that if no configuration file is found the server will fallback to the default one.

Anyway, take a quick read at this manual page (which you can access too from the terminal with man vsftpd) : http://vsftpd.beasts.org/vsftpd_conf.html

This other guide can help you with using custom directories for your server: http://gofedora.com/how-to-configure-secure-ftp-server-vsftpd/

Related Question