Permissions best practice: semi-shared hosting
Learning rookie here.
I've got LAMP running nicely, with virtual hosts located at:
/srv/www/
At the moment, www-data is the owner and group for everything here. I've offered to host some websites for an unemployed friend on my Linode. What would be the best practice for permissions, so that my friend only has access to his HTML and files.
As it's probably a one-off, I thought about creating a shell account for him, and storing his HTML within his home directory, with obvious permissions. But, this breaks my nice /srv/www/domain structure.
If I kept his HTML in /srv/www what would the permissions look like, to allow him access to only his files. Perhaps with a symlink from his shell account? Is there a "best practice" way for this?
Thanks, Richard.
7 Replies
Bear in mind that I'm a learning rookie, can you point me to a working config for Debian 5?
First edit /etc/ssh/sshd_config with the following values
Subsystem sftp internal-sftp
Match Group sftponly
ChrootDirectory /home/%u
ForceCommand internal-sftp
AllowTcpForwarding no
You should put them at the bottom.
Now add him a user as normal, setting the shell to /bin/false and adding them to the sftponly group.
Next chown root:root /home/[username] and chmod 0755 /home/[username]
Restart ssh and you're done.
The only caveat is that the user won't be able to write to /home/[username] I suggest adding a public_html folder and let them write to that.
I'll try this later.
Thanks very much for your help.
Richard
Now to work out Chroot'ing SSH shells…
However, I'm trying to become a competent Linux sysadmin, and this is something that would be good to know how to do.