Linux · Systems fluency

How do Linux users and groups work?

EasyusersgroupsidentityUpdated Oct 2026
Quiz this track

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.

sh
id
getent group sudo
groups deploy

The 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.

After changing group membership, existing sessions keep their old group set. The user must log in again, or a service must be restarted, to pick up the change.

Follow-ups you should expect

Interviewers use these to check whether the first answer was understanding or memorisation.

  1. 1What is the difference between a primary and a supplementary group?
  2. 2Why does group membership not apply to an existing shell immediately?
  3. 3How should service accounts be configured?
  4. 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.