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

I have two users, user1 and user2 which are both in a group matching their user name. I'd like both users to have full r/w/x permissions on all of each other's files as default without having to CHMOD them manually.

How can I set this up?

share|improve this question

You should have a users group in /etc/group. You can change them to this group and change umask to default file permissions to 664. These steps should do it.

  • Run chgrp -R users on both their home directories.
  • Enable group access on all their files chmod -R g+w on the directories they want to share. I would exclude Maildir if they have one.
  • Change their group membership with the command usermod -g users for each of their userids.
  • Uncomment the umask command in their .profile and change the value to 002 from 022.

For a project or privacy for these users you could add a new group or use one of their private groups in the commands above. If you chose user1, then you only need to change the group of user2. You still need to change access and umask for both.

EDIT: You can default new users to the users group by editing /etc/default/useradd. However, this would give all new users to the files owned by the two users you are modifying.

share|improve this answer

If the filesystem used supports ACLs I recommend their use in such selective user access control.

setfacl -m u:${USER}:rw

write and executable permissions should be given mutually exclusive (except for directories). Giving them both may cause serious security problems.

share|improve this answer

Create a new group to hold both users. As root:

groupadd foo

Then add both users to the group:

usermod -aG foo tommy
usermod -aG foo sally

Make sure their files have group read/write/execute permissions (at least 0770) and you should be set.

share|improve this answer
Thanks for your answer. Is there any way that I could have both users access each other's files even if, for example, permissions were set to 0644? This is the main problem I'm facing - where user1 would have a file set to 0644 and user2 cannot modify it. – James Haigh Feb 14 '11 at 13:53
@James You cannot easily get around the 0644 permissions, but if both users set their umasks to 002, files should be created group readable without manual intervention. They would do this by putting umask 002 in their .bashrc – KeithB Feb 14 '11 at 14:13
You're going to want to use the -a option for the usermod command, i.e. usermod -a -G foo tommy. Without it, the supplementary groups for the user will be set to only foo, most likely not the desired behavior. – cledoux Feb 14 '11 at 15:24
@chaz8705 Thanks! I'll fix my answer for future readers. – Patches Feb 14 '11 at 22:54

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.