JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
man pages section 4: File Formats     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

Introduction

File Formats

addresses(4)

admin(4)

ai_manifest(4)

alias(4)

aliases(4)

a.out(4)

au(4)

audit_class(4)

audit_event(4)

audit.log(4)

auth_attr(4)

autofs(4)

bart_manifest(4)

bart_rules(4)

bootparams(4)

cardbus(4)

compver(4)

contents(4)

contract(4)

copyright(4)

core(4)

crypt.conf(4)

crypto_certs(4)

dacf.conf(4)

dat.conf(4)

dc_manifest(4)

defaultdomain(4)

default_fs(4)

defaultrouter(4)

depend(4)

device_allocate(4)

device_contract(4)

device_maps(4)

devices(4)

devid_cache(4)

devname_cache(4)

dfstab(4)

dhcp_inittab(4)

dhcp_network(4)

dhcpsvc.conf(4)

dhcptab(4)

dialups(4)

dir(4)

dir_ufs(4)

d_passwd(4)

driver(4)

driver.conf(4)

ds.log(4)

dumpdates(4)

ethers(4)

exec_attr(4)

fbtab(4)

fd(4)

fdi(4)

flash_archive(4)

format.dat(4)

forward(4)

fs(4)

fspec(4)

fstypes(4)

ftp(4)

ftpusers(4)

fx_dptbl(4)

gateways(4)

geniconvtbl(4)

group(4)

gsscred.conf(4)

hba.conf(4)

holidays(4)

hosts(4)

hosts.equiv(4)

ib(4)

idnkit.pc(4)

ike.config(4)

ike.preshared(4)

inetd.conf(4)

inet_type(4)

infiniband_hca_persistent_cache(4)

init.d(4)

inittab(4)

ipaddrsel.conf(4)

ipf(4)

ipf.conf(4)

ipnat(4)

ipnat.conf(4)

ipnodes(4)

ippool(4)

ippool.conf(4)

isa(4)

issue(4)

kadm5.acl(4)

kdc.conf(4)

keytables(4)

krb5.conf(4)

label_encodings(4)

ldapfilter.conf(4)

ldapsearchprefs.conf(4)

ldaptemplates.conf(4)

llc2(4)

logadm.conf(4)

logindevperm(4)

loginlog(4)

magic(4)

md.cf(4)

mddb.cf(4)

mdi_ib_cache(4)

mdi_scsi_vhci_cache(4)

md.tab(4)

mech(4)

meddb(4)

mnttab(4)

mod_ipp(4)

mpapi.conf(4)

named.conf(4)

ncad_addr(4)

nca.if(4)

ncakmod.conf(4)

ncalogd.conf(4)

ncaport.conf(4)

ndmp(4)

ndpd.conf(4)

netconfig(4)

netgroup(4)

netid(4)

netmasks(4)

netrc(4)

networks(4)

nfs(4)

nfslog.conf(4)

nfssec.conf(4)

NISLDAPmapping(4)

nodename(4)

nologin(4)

note(4)

notrouter(4)

nscd.conf(4)

nss(4)

nsswitch.conf(4)

packingrules(4)

pam.conf(4)

pam.d(4)

passwd(4)

path_to_inst(4)

pci(4)

pcie(4)

pci_unitaddr_persistent(4)

phones(4)

pkginfo(4)

pkgmap(4)

plot(4B)

policy.conf(4)

priv_names(4)

proc(4)

process(4)

prof_attr(4)

profile(4)

project(4)

protocols(4)

prototype(4)

pseudo(4)

publickey(4)

qop(4)

queuedefs(4)

rcmscript(4)

rdc.cf(4)

registration_profile(4)

remote(4)

resolv.conf(4)

rhosts(4)

rmtab(4)

rndc.conf(4)

rpc(4)

rt_dptbl(4)

sasl_appname.conf(4)

sbus(4)

sccsfile(4)

scsi(4)

securenets(4)

sel_config(4)

sendmail(4)

sendmail.cf(4)

service_bundle(4)

service_provider.conf(4)

services(4)

shadow(4)

sharetab(4)

shells(4)

slp.conf(4)

slpd.reg(4)

smb(4)

smbautohome(4)

smhba.conf(4)

snapshot_cache(4)

sndr(4)

sock2path.d(4)

space(4)

ssh_config(4)

sshd_config(4)

submit.cf(4)

sulog(4)

sysbus(4)

syslog.conf(4)

system(4)

telnetrc(4)

term(4)

terminfo(4)

TIMEZONE(4)

timezone(4)

TrustedExtensionsPolicy(4)

ts_dptbl(4)

ttydefs(4)

ttysrch(4)

ufsdump(4)

updaters(4)

user_attr(4)

utmp(4)

utmpx(4)

vfstab(4)

volume-config(4)

volume-defaults(4)

volume-request(4)

wanboot.conf(4)

warn.conf(4)

wtmp(4)

wtmpx(4)

ypfiles(4)

yppasswdd(4)

ypserv(4)

zoneinfo(4)

passwd

- password file

Synopsis

/etc/passwd

Description

The file /etc/passwd is a local source of information about users' accounts. The password file can be used in conjunction with other naming sources, such as the NIS maps passwd.byname or password data stored on an LDAP server. Programs use the getpwnam(3C) routines to access this information.

Each passwd entry is a single line of the form:

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

where

username

is the user's login name.

The login (login) and role (role) fields accept a string of no more than eight bytes consisting of characters from the set of alphabetic characters, numeric characters, period (.), underscore (_), and hyphen (-). The first character should be alphabetic and the field should contain at least one lower case alphabetic character. A warning message is displayed if these restrictions are not met.

The login and role fields must contain at least one character and must not contain a colon (:) or a newline (\n).

password

is an empty field. The encrypted password for the user is in the corresponding entry in the /etc/shadow file. pwconv(1M) relies on a special value of 'x' in the password field of /etc/passwd. If this value of 'x' exists in the password field of /etc/passwd, this indicates that the password for the user is already in /etc/shadow and should not be modified.

uid

is the user's unique numerical ID for the system.

gid

is the unique numerical ID of the group that the user belongs to.

gecos-field

is the user's real name, along with information to pass along in a mail-message heading. (It is called the gecos-field for historical reasons.) An ``&'' (ampersand) 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 maximum value of the uid and gid fields is 2147483647. To maximize interoperability and compatibility, administrators are recommended to assign users a range of UIDs and GIDs below 60000 where possible. (UIDs from 0-99 inclusive are reserved by the operating system vendor for use in future applications. Their use by end system users or vendors of layered products is not supported and may cause security related issues with future applications.)

The password file is an ASCII file that resides in the /etc directory. Because the encrypted passwords on a secure system are always kept in the shadow file, /etc/passwd has general read permission on all systems and can be used by routines that map between numerical user IDs and user names.

Blank lines are treated as malformed entries in the passwd file and cause consumers of the file, such as getpwnam(3C), to fail.

The password file can contain entries beginning with a `+' (plus sign) or '-' (minus sign) to selectively incorporate entries from another naming service source, such as NIS or LDAP.

A line beginning with a '+' means to incorporate entries from the naming service source. There are three styles of the '+' entries in this file. A single + means to insert all the entries from the alternate naming service source at that point, while a +name means to insert the specific entry, if one exists, from the naming service source. A +@netgroup means to insert the entries for all members of the network group netgroup from the alternate naming service. If a +name entry has a non-null password, gecos, home-dir, or login-shell field, the value of that field overrides what is contained in the alternate naming service. The uid and gid fields cannot be overridden.

A line beginning with a `-' means to disallow entries from the alternate naming 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 a naming service), and –@netgroup means to disallow any subsequent entries for all members of the network group netgroup.

This is also supported by specifying ``passwd : compat'' in nsswitch.conf(4). The “compat” source might not be supported in future releases. The preferred sources are files followed by the identifier of a name service, such as nis or ldap. This has the effect of incorporating the entire contents of the naming service's passwd database or password-related information after the passwd file.

Note that in compat mode, for every /etc/passwd entry, there must be a corresponding entry in the /etc/shadow file.

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(1B) does the necessary locking.

Examples

Example 1 Sample passwd File

The following is a sample passwd file:

root:x:0:1:Super-User:/:/usr/sbin/sh
fred:6k/7KCFRPNVXg:508:10:& Fredericks:/usr2/fred:/bin/csh

and the sample password entry from nsswitch.conf:

passwd: files ldap

In this example, there are specific entries for users root and fred to assure that they can login even when the system is running single-user. In addition, anyone whose password information is stored on an LDAP server will be able to login with their usual password, shell, and home directory.

If the password file is:

root:x:0:1:Super-User:/:/usr/sbin/sh
fred:6k/7KCFRPNVXg:508:10:& Fredericks:/usr2/fred:/bin/csh
+

and the password entry in nsswitch.conf is:

passwd: compat

then all the entries listed in the NIS passwd.byuid and passwd.byname maps will be effectively incorporated after the entries for root and fred. If the password entry in nsswitch.conf is:

passwd_compat: ldap
passwd: compat

then all password-related entries stored on the LDAP server will be incorporated after the entries for root and fred.

The following is a sample passwd file when shadow does not exist:

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

The following is a sample passwd file when shadow does exist:

root:##root:0:1:Super-User:/:/usr/sbin/sh
fred:##fred:508:10:& Fredericks:/usr2/fred:/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 naming service source 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 gecos field of Guest.

Files

See Also

chgrp(1), chown(1), finger(1), groups(1), login(1), newgrp(1), passwd(1), sh(1), sort(1), domainname(1M), getent(1M), pwck(1M), pwconv(1M), su(1M), useradd(1M), userdel(1M), usermod(1M), a64l(3C), crypt(3C), getpw(3C), getpwnam(3C), getspnam(3C), putpwent(3C), group(4), hosts.equiv(4), nsswitch.conf(4), shadow(4), environ(5), unistd.h(3HEAD)

Oracle Solaris Administration: Common Tasks

Notes

The solaris.user.manage and solaris.role.manage authorizations are required to modify the passwd fields for users and roles respectively. These authorizations allow an administrator to set the username, uid, gecos-field, home-dir, and login-shell for users and roles respectively. Setting the gid requires the solaris.group.delegate/assign authorization. See group(4).