Linux

Where Are Linux User Accounts Stored?

Linux keeps accounts in /etc/passwd, secret hashes in /etc/shadow, and groups in /etc/group.

Last updated

Linux splits account data three ways by sensitivity. Usernames, shells and home directories sit world readable in passwd, password hashes hide root only in shadow, and memberships live in group.

Edit them with vipw and vigr rather than a text editor, since those tools lock against concurrent changes. Always keep a root shell open while editing, in case a typo locks everyone out.

Where Linux stores this, by platform

Linux
/etc/passwd

Seven colon fields per user: name, placeholder, UID, GID, comment, home, shell. Hashes moved to /etc/shadow with 640 root ownership. Groups in /etc/group beside both.

Frequently asked questions

why is there an x in the password field of passwd

It means the real hash lives in /etc/shadow. The x is a placeholder so programs know to look there instead of comparing against the world readable file.

how do i safely edit passwd or shadow

Use vipw for passwd and vigr for group and gshadow. They lock the files and validate syntax, preventing the corruption a plain editor risks.

where are linux group memberships stored

In /etc/group, one line per group with member lists. Secondary groups grant access; the primary GID comes from the passwd entry itself.

Notice an outdated path? Let us know.