The User List
/etc/passwd and /etc/group.
Linux keeps its list of users in a plain text file. You can read it yourself, with the commands you already know. It's a nice reminder, that on Linux, almost everything is a file.

- Users live in a text file
- Read it yourself
- Almost everything is a file
Reading slash etc slash passwd
The file is slash ETC slash passwd. Each line is one user, with fields separated by colons. There are lots of system users, so we only look at the last two lines, with tail. There's Sam, and a second person, Alex.
tail -n 2 /etc/passwd sam:x:1000:1000::/home/sam:/bin/bash alex:x:1001:1001::/home/alex:/bin/bash grep sam /etc/passwd sam:x:1000:1000::/home/sam:/bin/bash
The fields
Let's read Sam's line, field by field. The username, sam. An X, which means the password is stored somewhere else, in a protected file. The user number, one thousand. The group number. A description. The home folder, slash home slash sam. And the shell, bash.
| Field | Value | Meaning |
|---|---|---|
| 1 | sam | username |
| 2 | x | password kept elsewhere |
| 3, 4 | 1000:1000 | user and group numbers |
| 6 | /home/sam | home folder |
| 7 | /bin/bash | login shell |
Groups are in a file too
Groups live in slash ETC slash group, in the same colon separated style. The sudo group lists its members at the end. That's how Linux knows Sam is allowed to run admin commands.
grep sudo /etc/group sudo:x:27:sam
Summary
Users are listed in slash ETC slash passwd, and groups in slash ETC slash group. Passwords are kept somewhere safer. Next, permissions.
Key takeaways- /etc/passwd
- /etc/group
- Fields split by :