What's the right way to create a Ubuntu user whose home directory is /var/www/SITE?
- by Leonnears
First of, I need to state I'm a complete ignorant when it comes to server administration on Ubuntu, and I'm doing what I can. I have been trying to do this for hours with no luck.
Basically, I want to create a Ubuntu user whose home directory is /var/www/SITE, and prefered it is chroot'd to it. The chroot part is not so important right now, as first I prefer to make anything work. The user should be able to upload files here and the webserver (www-data user?) should be able to pick them up with no problem.
I was able to create the user and give it the home directory /var/www/SITE. (the user is "anders"). I gave him a password, and "anders" can connect to FTP just fine and upload files.
But here's where things don't work: While my user can upload files to that /var/www/SITE directory, when I access the webpage on my browser I get a Forbidden error. Note that anders is also a member of the www-data group. I can fix this by running
sudo chmod g+s /var/www/SITE/* anders -R
but this is of course not ideal. Ideally the files should "work" as soon as I upload them. What's the right way to fix this?
If it matters (don't think so), I'm editing my files in Coda 2 and anders is the user for it.