Check and repair /etc/passwd and /etc/shadow entries to keep account data consistent and safe. 09.06.2026 | reading time: 2 min The command `pwck` helps the administrator verify the integrity of the password database and the shadow file; it finds malformed lines, missing or mismatched shadow entries, duplicate UIDs and suspicious shells so you can act before users notice access problems. Why run pwck? Run `pwck` after manual edits, bulk user imports or migrations: it tells you which entries are broken and where to look, so you can prevent login failures and permission surprises without guessing. Example run Hands-on: create test files and run `pwck` to see how it reports issues. ``` # create test passwd file cat > /tmp/passwd.test <<'EOF' alice:x:1001:1001:Alice:/home/alice:/bin/bash bob:x:1002:1002:Bob:/home/bob:/bin/doesnotexist dup:x:1002:1003:Dup:/home/dup:/bin/bash EOF # create simple shadow cat > /tmp/shadow.test <<'EOF' alice:!:18000:0:99999:7::: bob:!:18000:0:99999:7::: EOF # run check against those files pwck /tmp/passwd.test /tmp/shadow.test ``` Possible output: ``` /tmp/passwd.test: line 2: invalid shell '/bin/doesnotexist' /tmp/passwd.test: line 3: duplicate UID 1002 pwck: passwd and shadow entries are inconsistent ``` Options that matter Use `pwck` in read-only mode first to inspect problems; then consider repair mode (often available as `-r`) to accept or remove problematic entries interactively; you can also point `pwck` at alternate files when testing, and always back up passwd and shadow before making repairs. Complementary utilities Pair `pwck` with tools that edit or repair account data safely: `vipw` for safe passwd edits, `grpck` to verify group files, and `pwconv`/`grpconv` to synchronize passwd and shadow data; use `getent` to view resolved account info when troubleshooting. Final note A quick `pwck` run catches many subtle account problems and is an efficient first step in user-account troubleshooting; if you want deeper mastery, study more Linux administration topics and consider certification such as CompTIA Linux+ or LPIC-1, with intensive exam preparation available at bitsandbytes.academy. Join Bits & Bytes Academy First class LINUX exam preparation. utilities security filesystem troubleshooting