PWCK(8)

๐Ÿ’– PWCK ๐Ÿ’–

okay bestie, so this one's pwck from section 8 of the manual โ€” it lives in the System Management Commands crowd, and it is literally the vibe-checker for your password files. no cap.


โœจ NAME โœจ

pwck โ€” verify the integrity of password files ๐Ÿซถ


โœจ SYNOPSIS โœจ

pwck [options] [PASSWORDFILE [ SHADOWFILE ]]

โœจ DESCRIPTION โœจ

so the pwck command is out here checking the integrity of your users and your authentication info. it goes through every entry in /etc/passwd and /etc/shadow and makes sure they have the proper format and hold valid data. and if something is improperly formatted or has some other uncorrectable error? it asks the user โ€” that's you โ€” to delete that entry. not me being the bouncer at the club ๐Ÿ’…

here's what it checks for, entry by entry:

  • the correct number of fields
  • a unique and valid user name
  • a valid user and group identifier
  • a valid primary group
  • a valid home directory
  • a valid login shell

the shadowed password info checks turn on when you pass the second file parameter, SHADOWFILE, or when /etc/shadow exists on the system. either/or, queen.

and these checks are the following:

  • every passwd entry has a matching shadow entry, and every shadow entry has a matching passwd entry
  • passwords are specified in the shadowed file
  • shadow entries have the correct number of fields
  • shadow entries are unique in shadow
  • the last password changes are not in the future

now listen, because this part matters: the checks for correct number of fields and unique user name are fatal. if an entry has the wrong number of fields, the user gets prompted to delete the entire line. and if the user doesn't answer affirmatively, all further checks are bypassed. gone. skipped. an entry with a duplicated user name gets prompted for deletion too, but the remaining checks will still be made โ€” so that one's a soft launch, not a full cancel. every other error is just a warning, and the user is encouraged to run the usermod command to fix it.

and here's the tea: the commands that operate on the /etc/passwd file are not able to alter corrupted or duplicated entries. so in those circumstances, pwck should be used to remove the offending entry. it's giving main character energy, fr fr ๐ŸŒŸ


โœจ OPTIONS โœจ

okay first thing: the -r and -s options cannot be combined. pick a lane bestie, you can't have both ๐ŸŽ€

the options which apply to the pwck command are:

  • --badname โ€” allow names that do not conform to standards. living on the edge, i respect it โœจ
  • -h, --help โ€” display help message and exit. the classic "what does this do again" move ๐Ÿ’…
  • -q, --quiet โ€” report errors only. the warnings which do not require any action from the user won't be displayed. silence is golden ๐Ÿ”‡
  • -r, --read-only โ€” execute the pwck command in read-only mode. look but don't touch ๐Ÿซถ
  • -R, --root CHROOT_DIR โ€” apply changes in the CHROOT_DIR directory and use the configuration files from the CHROOT_DIR directory. only absolute paths are supported. **no SELINUX support. ๐Ÿšซ
  • -s, --sort โ€” sort entries in /etc/passwd and /etc/shadow by UID. so satisfying, honestly ๐Ÿงš

by default, pwck operates on the files /etc/passwd and /etc/shadow. the user may select alternate files with the passwd and shadow parameters. customize your own adventure ๐Ÿ’–


โœจ CONFIGURATION โœจ

these configuration variables in /etc/login.defs change the behavior of this tool:

  • NONEXISTENT (string) โ€” if a system account intentionally does not have a home directory that exists, this string can be provided in the /etc/passwd entry for the account to indicate this. the result is that pwck will not emit a spurious warning for this account. no false alarms, no drama ๐ŸŒธ
  • PASS_MAX_DAYS (number) โ€” the maximum number of days a password may be used. if the password is older than this, a password change will be forced. if not specified, -1 will be assumed (which disables the restriction).
  • PASS_WARN_AGE (number) โ€” the number of days warning given before a password expires. a zero means warning is given only upon the day of expiration, a value of -1 means no warning is given. if not specified, no warning will be provided.

โœจ FILES โœจ

  • /etc/group โ€” group account information.
  • /etc/passwd โ€” user account information.
  • /etc/shadow โ€” secure user account information. ๐Ÿ”’

โœจ EXIT VALUES โœจ

the pwck command exits with the following values:

  • 0 โ€” success ๐ŸŽ‰
  • 1 โ€” invalid command syntax
  • 2 โ€” one or more bad password entries
  • 3 โ€” can't open password files
  • 4 โ€” can't lock password files
  • 5 โ€” can't update password files
  • 6 โ€” can't sort password files

โœจ SEE ALSO โœจ

group(5), grpck(8), passwd(5), shadow(5), usermod(8).


and that's the whole page bestie, you ate that ๐Ÿ’…โœจ this one's brought to you by shadow-utils 4.20.0, dated 07/30/2026 โ€” go forth and verify those password files, ily ๐Ÿซถ๐ŸŽ€

๐Ÿ“ฆ where this page comes from