Passwd

This article describes the format of the traditional Unix  file, and related files, including ,  , and. These files contain information about user accounts. They use text-based formats with colon-separated fields, with one line per user or group.

Note that on modern systems, this is not the only way to manage users. Other methods, such as LDAP or Winbind, may be used as well. The methods to use are usually configured in the  file.

The name of the  file has become a misnomer, as (hashed) passwords are now rarely stored in it. If hashed passwords are stored locally, they will be in the  file instead.

crypt
The password field in the  or   file traditionally uses an algorithm and format known simply as crypt. The algorithm uses a DES block cipher, which limits passwords to 8 7-bit characters.

A crypted password is stored as 13 ASCII characters, encoded with a form of Base64. The first two characters encode a 12-bit salt, and the rest encode the hashed password.

One way to generate crypted passwords is with OpenSSL. For example: $ openssl passwd -crypt -salt AB pass1234

Other password formats
The original crypt format is not very secure. Modern systems often use a different format, which begins with a dollar sign: $&lt;algorithm-id>$&lt;salt>$&lt;hashed password>

The algorithm identifiers are not necessarily standardized, but the following are typical on GNU/Linux systems:

GECOS
The so-called GECOS field in the  file contains several comma-separated subfields. The subfields include the user's full name, and other information such as phone numbers.

The name GECOS is a nonsensical accident of history. It originally stood for something like General Electric Comprehensive Operating Supervisor (there is conflicting information about whether the S stood for Supervisor, or System).

Software

 * Many standard utility programs are related to reading and writing these files, including,  ,  , and.
 * Programmatically, to look up user information, the  family of C library functions may be used. (But password-related functions should probably be done via PAM instead, i.e. with   and related functions.)

Links

 * Passwd
 * Passwd
 * Passwd
 * Crypt (C)
 * Gecos field
 * IBM Knowledge Center: Using the /etc/passwd file
 * LINFO: The /etc/passwd File