Linux – Second field in /etc/shadow

linuxpasswordshadow

If the second field of the /etc/shadow file is set to !!, does it mean that the account is disabled? Or does it mean that the account is active with no password assigned?

Best Answer

If the password field contains some string that is not a valid result of crypt(3), for instance ! or *, the user will not be able to use a unix password to log in (but the user may log in the system by other means e.g .key based login).

crypt() is the password encryption function. It is based on the Data Encryption Standard algorithm with variations intended (among other things) to discourage use of hardware implementations of a key search key is a user's typed password. Salt is a two-character string chosen from the set [a–zA–Z0–9./]. Following are some status exception values.

  • "NP" or "!" or null - No password, the account is locked, no user can log in.
  • "LK" or "*" - the account is Locked, user will be unable to log-in
  • "!!" - is a Red Hat convention that means a password has never been set before. It is treated the same as "!"

Sources: man shadow and man 3 crypt, Shadow File from Wikipedia and Red Hat.

Related Question