0

Is it possible to have multiple SSH users who can't read/write each others files but still allowing Lighttpd to serve their files?

Each user would have different domains.

1 Answer 1

2

Make each user's files readable by their usergroup, and then add lighttpd to each user's usergroup.

If we have bob and charlie, and lighttpd is running as www-data:

# Bob and Charlie own their public_html folders
# And cannot see each others' files
chown bob:bob /home/bob/public_html
chmod 770 /home/bob/public_html

chown charlie:charlie /home/charlie/public_html
chmod 770 /home/charlie/public_html

# But the webserver can see both their files
adduser www-data bob
adduser www-data charlie

This will add the www-data user to the primary groups for bob and charlie, and allow the webserver to read any files marked under their group with group access. (Assuming that your webserver is running as www-data. This might vary from system to system)

7
  • Darth, could you expand a bit with an example command? May 24, 2013 at 5:47
  • I know it wasn't part of the original question... but what about PHP? PHP will be able to have access to everything so it seems trivial to use PHP as a proxy to read / write.
    – Michael
    May 28, 2013 at 16:41
  • @Michael PHP will have access based on whatever user PHP is running under. If you're running php as an internal wbeserver module (like with apache), then it has whatever access that the webserver does. If you have it running externally (like with php-fpm), then that usually runs under another user, which also needs to be granted access to each user's files. May 28, 2013 at 19:27
  • @Luke Uh.... those are all example commands. Can you be more specific with what you're asking? May 28, 2013 at 19:27
  • @DarthAndroid Sorry, when I saw that, it didn't have any commands (it was in the LQ queue) May 28, 2013 at 19:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .