Server Fault is a question and answer site for system and network administrators. 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

3 users, 1 folder. Users: vsftpd (FTP server), bobmarley (normal user), www-data (Apache user)

How to unite them and make so that each user can modify any of these user's data, without doing CHMOD 777?

Ex.: bobmarley created a file '' www-data tries to access the file, and succeeds. vsftpd user accesses the file and can modify it, too.

share|improve this question

Create a group (groupadd)... chgrp of the directory to that new group... and then add each user to that group. That's the easiest way. You may also want to chmod g+s on the directory to make sure that new files are created with the same group as the parent directory.


share|improve this answer
groupadd webapp
usermod -a -G webapp vsftpd (but I think it should be nobody)
usermod -a -G webapp bobmarley
usermod -a -G webapp www-data
chgrp -R webapp /path/to/folder
chmod -R g+w /path/to/folder

If you have existing data in this folder, you can set SGID for all sub-folders with:

find /path/to/folder -type d -print0 | xargs -0 chmod g+s /path/to/folder

Remember to set the umask for vsftpd, Apache and bobmarley to 002. With this config, all files created by any user will has 664 permission, owned by webapp group, and other users can modify.

share|improve this answer

Put them all in a common group. chgrp the files to that group. chmod the files/dirs to 664/775.

share|improve this answer

Group them. This is why there are groups in POSIX. Create a group xyz and put vsftpd, bobmarley and www-data into it.

And then assign the group to the folder/files with chgrp.

share|improve this answer

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.