π₯ Adding Users to Groups
Think of groups as teams or departments in our office.
β’ A group is like a team that shares access to certain rooms or resources.
β’ A user can belong to one or more groups, like an employee being part of Marketing and Project A team.
β’ Some users might also be given special powers, like a manager who can enter any roomβthis is like sudo privileges.
2a. groupadd
groupadd is like creating a new team in the company.
Now we have a team called developers. Anyone added to this group can access shared resources for that team.
2b. usermod
usermod is how you assign employees to teams.
- -aG β append this group to their list (don't remove from other groups).
Real-life analogy: John is officially added to the Developers team without kicking him out of Marketing.
To check groups a user belongs to.
2c. Giving a user sudo privileges
Sudo = giving a user manager-level access.
Managers can perform any operation in the office, like modifying office-wide files.
Usually, the sudo group is pre-defined. Add a user to it:
Now John can use commands like:
Real-life analogy: John now has the key to the main office and can approve big changes, but still logs in with his own employee ID.
Real-life analogy
β
Key takeaway:
1. groupadd = create a team
2. usermod -aG groupname username = add user to a team
3. sudo group = manager-level access