Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a folder (/var/www/test7.com), which must be readable/writable by www-data AND test7 users.

test7 user should not have access to other websites.

How can I do that?

share|improve this question
1  
Can't you put both users in a new group? – htorque Apr 10 '11 at 18:06
I've posted an answer below, but a solution not involving group tricks would be symlinks within the test7.com directory to locations owned by www-data. That would prevent users from messing with webserver files. – ImaginaryRobots Apr 10 '11 at 18:12

3 Answers

up vote 7 down vote accepted

Create a group, put both users in this group and type:

chown -R GROUPNAME /var/www/test7.com/*

I hope this helped you, Daniel

share|improve this answer

The simplest way would be to add the www-data user to the test7 group, and have the files owned by test7, not www-data.

share|improve this answer

most confusing way would be to use 'acl' (apt-get install acl) tool to create advanced control lists, where you can allow/disallow access to files using advanced rules.

for example, you have directory owned by root and 3 other users, using acl you can set that direcotry owner is still root with 700 rights, but then set acl that will allow one user to read files, and other 2 read/write files in the directory.

All of that can be done using setfacl (to set up permissions) getfacl (to read permissions). Directories can have default settings what to assign to files/folders.

If not used with care you can mess up permissions pretty good.

share|improve this answer

Your Answer

 
discard

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.