Users and Groups
Who can do what.
Linux was built from the start for many people sharing one computer. So it needs to know who's who, and who's allowed to do what. That's what users and groups are for.

- Built for sharing
- Who's who?
- Users and groups
Users and groups
Every person who uses the computer gets a user account, with a name, a number, and a home folder. Programs often get their own users too, so they can't touch your files. A group is a collection of users. Give a group access to something, and everyone in it gets access.
Who am I, really
ID shows your user, and every group you belong to. Sam's user number is one thousand, and Sam is in a group called sam, plus a group called sudo. Groups prints just the group names. And W shows who's logged in right now.
id uid=1000(sam) gid=1000(sam) groups=1000(sam),27(sudo) groups sam sudo
A group of your own
Notice that Sam has a group with the same name. When Linux creates a user, it usually creates a matching group too, with just that user in it. That's why the long listing showed sam, sam. The owner was sam, and the group was also sam.
| key | value |
|---|---|
| User sam | UID 1000 |
| Group sam | made automatically |
| ls -l | shows owner and group |
| sudo group | may run admin commands |
Summary
Every person has a user account, and users belong to groups. ID and groups show yours. Next, where Linux stores the list of users.
Key takeaways- Users and groups
- id
- groups