Linux User Permissions?
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 to002
from022
.
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.
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.