In Unix-like operating systems the /etc/passwd file lists information about each of the users that may login to the system. In many operating systems today this file is just one of many possible back-ends for the more general passwd name service.
The file is named as originally it also contained the data used to verify passwords. However, on modern Unix systems the security-sensitive password information is instead often stored in a different file using shadow passwords.
The /etc/passwd file typically has world-readable permissions, though it may only be edited by the superuser or by using a few special purpose commands.
Contents |
File format
The /etc/passwd file is a text file with one record per line, each describing a user account. Each record consists of seven fields separated by colons. [1] The ordering of the records within the file is generally unimportant.
An example record may be:
jsmith:x:1001:1001:Joe Smith,Room 1007,(234)555-8910,(234)555-0044,email:/home/jsmith:/bin/bash
The fields, in order from left to right, are:
- The first field is the user name, i.e. the string a user would type in when logging into the operating system: the logname. Each record in the file must have a unique user name field.
- The second field stores information used to validate a user's password; however in most modern uses this field is usually set to "x" (or some other indicator) with the actual password information being stored in a separate shadow password file. Setting this field to an asterisk "*" is the typical way to deactivate an account to prevent it being used.
- The third field is the user identifier, the number that the operating system uses for internal purposes. It does not have to be unique.
- The fourth field is the group identifier. This number identifies the primary group of the user; all files that are created by this user will initially belong to this group.
- The fifth field, called the Gecos field, is commentary that describes the person or account. Typically, this is a set of comma-separated values including the user's full name and contact details.
- The sixth field is the path to the user's home directory.
- The seventh field is the shell program that is started every time the user logs into the system.
See also
- Shadow password
- crypt(3) - a library function implementing a password encryption algorithm
- Gecos field
- getent - a library function to lookup passwd records
- passwd - a command that allows a user to change their password
- chfn - a command that allows a user to change their gecos information
- chsh - a command that allows a user to change their shell
- vipw - a command to safely edit the /etc/passwd file
External links
References
This entry is from Wikipedia, the leading user-contributed encyclopedia. It may not have been reviewed by professional editors (see full disclaimer)




