UNIX & Linux: /etc/passwd File

The /etc/passwd file contains basic user attributes. This is an ASCII file that contains an entry for each user. Each entry defines the basic attributes applied to a user. When you use the mkuser command to add a user to your system, the command updates the /etc/passwd file.

An entry in the /etc/passwd file has the following form:

Name: Password: UserID: PrincipleGroup: Gecos: HomeDirectory: Shell

Explanation

Name: Specifies the user’s login name. There are a number of restrictions on naming users. See the mkuser command for more information.

Password: Contains an * (asterisk) indicating an invalid password or an ! (exclamation point) indicating that the password is in the /etc/security/passwd file. Under normal conditions, the field contains an !. If the field has an * and a password is required for user authentication, the user cannot log in.

UserID: Specifies the user’s unique numeric ID. This ID is used for discretionary access control. The value is a unique decimal integer.

PrincipleGroup: Specifies the user’s principal group ID. This must be the numeric ID of a group in the user database or a group defined by a network information service. The value is a unique decimal integer.

Gecos: Specifies general information about the user that is not needed by the system, such as an office or phone number. The value is a character string. The Gecos field cannot contain a colon.

HomeDirectory: Specifies the full path name of the user’s home directory. If the user does not have a defined home directory, the home directory of the guest user is used. The value is a character string.

Shell: Specifies the initial program or shell that is executed after a user invokes the login command or su command. If a user does not have a defined shell, /usr/bin/sh, the system shell, is used. The value is a character string that may contain arguments to pass to the initial program.

Example

# more /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/bin/bash
daemon:x:2:2:Daemon:/sbin:/bin/bash
named:x:44:44:Name server daemon:/var/lib/named:/bin/false
postfix:x:51:51:Postfix Daemon:/var/spool/postfix:/bin/false
sshd:x:71:65:SSH daemon:/var/lib/sshd:/bin/false
ntp:x:74:65534:NTP daemon:/var/lib/ntp:/bin/false
ldap:x:76:70:User for OpenLDAP:/var/lib/ldap:/bin/bash
databaseuser:x:323:201:Database Administrator:/oracle/databaseuser:/bin/csh
osuser:x:324:200:System Administrator:/home/osuser:/bin/csh
nobody:x:65534:65533:nobody:/var/lib/nobody:/bin/bash
itsiti:x:1000:100:ITsiti:/home/itsiti:/bin/bash
# cat /etc/passwd | grep root
root:x:0:0:root:/root:/bin/bash

You May Also Like

1 Comment

Leave a Reply?