LOGBOOK

HELP

Quiz Entry - updated: 2026.10.13

What is /etc/passwd for, what does a line contain, and why are the password hashes not in it?

It is the local user database: one line per account with name, UID, GID, description, home directory and login shell; the hashes sit in /etc/shadow, which only root can read.

A line has seven fields separated by colons:

labadmin:x:1000:1000:Lab Admin,,,:/home/labadmin:/bin/bash
name    pw UID  GID  comment      home           shell

The x in the password field means "the hash is in /etc/shadow". Originally the hash was here. But /etc/passwd must be readable by every user (every ls -l uses it to turn UIDs into names), so every user could copy all the hashes and crack them offline. Moving them to /etc/shadow (mode 640 or 600, owner root) splits the public part from the secret part.

getent passwd <name> reads the same record, but through the system's name service (nsswitch.conf). It therefore also finds users that come from a directory such as Active Directory and never appear in the file itself.

Go deeper:

From Quiz: ISLAB / Access Management on Linux | Updated: Oct 13, 2026