Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 2 down vote accepted

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)

share|improve this answer
Darth, could you expand a bit with an example command? – Canadian Luke May 24 '13 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 '13 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. – Darth Android May 28 '13 at 19:27
@Luke Uh.... those are all example commands. Can you be more specific with what you're asking? – Darth Android May 28 '13 at 19:27
@DarthAndroid Sorry, when I saw that, it didn't have any commands (it was in the LQ queue) – Canadian Luke May 28 '13 at 19:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.