VSFTPD setup not complete

February 20, 2013 3.6k views
Hello, The VSFTPD article does not explain how to complete the setup for web servers. Most of the users will be using it with Apache/nginx/etc. so it will be really useful if you could write an article explaining how to set that up, what are appropriate permissions etc. Until then - I would really appreciate if someone could post the setup here, as I'm struggling with it now. The web is full of resources but none of them offer a universal solution and most of them are outdated. Thanks!
3 Answers
Well, enable LocalUsers in VSFtpd, chroot them into their homes and you're most likely done - short version, sorry :-)
That's not the point of my question.

I want this to work with a webserver and to allow users to upload files to /var/www/ and not to /home/[user]/files
VSFTPD, and any other FTP solution is going to upload / chroot to the users home directory, so if, when you created a user, you set their home directory to /home/username, then that's the directory that will be used by vsftpd.

You can use useradd -d to set the home directory for new users, i.e.

useradd -d /path/to/upload/folder username

So if your username was batric, for example, and you wanted the user to upload to /var/www or /var/www/batric, then you'd use one of the following:

useradd -d /var/www batric

- OR -

useradd -d /var/www/batric batric

You can use usermod to change the directory of an existing user.

usermod -d /var/www batric

usermod -d /path/to/any/directory batric

usermod -d /home/batric

....etc :-).
Have another answer? Share your knowledge.