Creating Hierarchical User Permissions Tutorial
Dealing with multiple users on a single box can be frustrating at first. Especially when they edit the same files. I wanted to create a sort of hierarchy of users with my root and personal accounts at the top, and a pool of sub-accounts below. Here’s how I solved this problem in Ubuntu:
First, create a common group:
groupadd <group-name>
Next, make sure all of the sub-accounts use the new group as its default account.
For new users:
useradd -G <group-name> <username>
For existing users:
usermod -a -G <group-name> <username>
When a user creates a file or directory, they normally would use their own group. What we want is that any account in the common group to use the new group as its default:
usermod -g <group-name> <username>
Last, change the sub-users’ default umask settings so that it treats its own settings exactly the same as the group settings. Make sure to only run this command as one of the sub-accounts:
umask 0002Now you have a list of accounts with limited permissions that your main account will always have access to. Now this is not an optimal, and probably secure solution, but since this only for my development environment, its good enough.