Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

login(1)

mail(1)

passwd(1)

crypt(3)

getpwent(3)

group(5)

adduser(8)

sendmail(8)

vipw(8)

mkpasswd(8)

PASSWD(5)  —  UNIX Programmer’s Manual

NAME

passwd − password file

SYNOPSIS

/etc/passwd

DESCRIPTION

The passwd file contains basic information about each user’s account.  This file contains a one-line entry for each authorized user, of the form:

username:password:uid: gid:gcos-field:home-dir: login-shell

where

username is the user’s login name.  This field contains no uppercase characters, and must not be more than eight characters in length. 

password is the user’s encrypted password.  If this field is empty, login(1) does not request a password before logging the user in.

uid is the user’s numerical ID for the system, which must be unique.  uid is generally a value between 0 and 65535. 

gid is the numerical ID of the group that the user belongs to.  gid is generally a value between 0 and 65535. 

gcos-field is the user’s real name, along with information to pass along in a mail-message heading.  It is called the gcos-field for historical reasons.  A & in this field stands for the login name (in cases where the login name appears in a user’s real name). 

home-dir is the pathname to the directory in which the user is initially positioned upon logging in. 

login-shell is the user’s initial shell program.  If this field is empty, the default shell is /usr/bin/sh.

The passwd file can also have lines beginning with a ‘+’ (plus sign) which means to incorporate entries from the Network Information Service.  There are three styles of + entries in this file: by itself, + means to insert the entire contents of the Network Information Service password file at that point; +name means to insert the entry (if any) for name from the Network Information Service at that point; +@netgroup means to insert the entries for all members of the network group netgroup at that point.  If a +name entry has a non-NULL password, gcos, home-dir, or login-shell field, the value of that field overrides what is contained in the Network Information Service.  The uid and gid fields cannot be overridden. 

The passwd file can also have lines beginning with a ‘−’ (minus sign) which means to disallow entries from the Network Information Service.  There are two styles of ‘−’ entries in this file: −name means to disallow any subsequent entries (if any) for name (in this file or in the Network Information Service); −@netgroup means to disallow any subsequent entries for all members of the network group netgroup. Note: lines beginning with a ‘-’ must be of the form -name::0:0: or -@netgroup::0:0: and must appear in the passwd file before any lines beginning with a ‘+’.

The password file is an ASCII file that resides in the /etc directory.  /etc/passwd has general read permission on all systems, and can be used by routines that map numerical user IDs to names. 

Appropriate precautions must be taken to lock the /etc/passwd file against simultaneous changes if it is to be edited with a text editor; vipw(8) does the necessary locking. vipw(8) also calls mkpasswd(8) which updates the hashed password database.

EXAMPLE

Here is a sample passwd file:

root:q.mJzTnu8icF.:0:10:Super User:/:/usr/bin/csh
fred:6k/7KCFRPNVXg:508:10:% Fredericks:/usr2/fred:/usr/bin/csh
+john:
+@documentation:no-login:
+::::Guest

In this example, there are specific entries for users root and fred, to assure that they can log in even when the system is running standalone.  The user john will have his password entry in the Network Information Service incorporated without change; anyone in the netgroup documentation will have their password field disabled, and anyone else will be able to log in with their usual password, shell, and home directory, but with a gcos-field of Guest. 

FILES

/etc/passwd

SEE ALSO

login(1), mail(1), passwd(1), crypt(3), getpwent(3), group(5), adduser(8), sendmail(8), vipw(8), mkpasswd(8)

BUGS

mail(1) and sendmail(8) use the gcos-field to compose the From: line for addressing mail messages, but these programs get confused by nested parentheses when composing replies.  This problem can be avoided by using different types of brackets within the gcos-field; for example:

(& Fredricks [Podunk U <EE/CIS>] {818}-555-5555)

7th Edition  —  Revision 1.11 of 23/11/90

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026