Linux · Systems fluency
How do Linux users and groups work?
Short answer
Every process runs with a user ID and group IDs. Users are defined in /etc/passwd, groups in /etc/group, and password hashes in /etc/shadow, so groups grant shared access without sharing credentials.
A user has a numeric UID, a primary GID, and optional supplementary groups. The kernel checks these numeric IDs, not the human-readable names, so a name change does not change ownership of existing files.
id
getent group sudo
groups deployThe identity files
- /etc/passwd: username, UID, GID, home directory, and login shell
- /etc/shadow: password hashes and aging data, readable only by root
- /etc/group: group name, GID, and member list
- sudo group membership is distribution-specific and controls sudo access
Service accounts should have no interactive login shell, no password login, and only the groups they need. Sharing a single account across services destroys auditability because logs cannot distinguish the actors.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1What is the difference between a primary and a supplementary group?
- 2Why does group membership not apply to an existing shell immediately?
- 3How should service accounts be configured?
- 4What does the UID represent during permission checks?
Say it in the interview
A user has a UID, a primary GID, and supplementary groups. The kernel uses those numeric IDs for permission checks. User data lives in /etc/passwd, group data in /etc/group, and hashes in /etc/shadow. Service accounts should be non-interactive and limited to the groups they need, because shared accounts make audit logs useless.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live Linux mock interview and get scored feedback on depth, clarity and confidence.