<s>
passwd	B-Protocol
is	O
a	O
command	B-Application
on	O
Unix	B-Application
,	O
Plan	B-Operating_System
9	I-Operating_System
,	O
Inferno	B-Operating_System
,	O
and	O
most	O
Unix-like	B-Operating_System
operating	I-Operating_System
systems	I-Operating_System
used	O
to	O
change	O
a	O
user	O
's	O
password	O
.	O
</s>
<s>
The	O
password	O
entered	O
by	O
the	O
user	O
is	O
run	O
through	O
a	O
key	B-Algorithm
derivation	I-Algorithm
function	I-Algorithm
to	O
create	O
a	O
hashed	B-Error_Name
version	I-Error_Name
of	O
the	O
new	O
password	O
,	O
which	O
is	O
saved	O
.	O
</s>
<s>
Only	O
the	O
hashed	B-Error_Name
version	I-Error_Name
is	O
stored	O
;	O
the	O
entered	O
password	O
is	O
not	O
saved	O
for	O
security	O
reasons	O
.	O
</s>
<s>
When	O
the	O
user	O
logs	O
on	O
,	O
the	O
password	O
entered	O
by	O
the	O
user	O
during	O
the	O
log	O
on	O
process	O
is	O
run	O
through	O
the	O
same	O
key	B-Algorithm
derivation	I-Algorithm
function	I-Algorithm
and	O
the	O
resulting	O
hashed	B-Error_Name
version	I-Error_Name
is	O
compared	O
with	O
the	O
saved	O
version	O
.	O
</s>
<s>
If	O
the	O
hashes	B-Algorithm
are	O
identical	O
,	O
the	O
entered	O
password	O
is	O
considered	O
to	O
be	O
correct	O
,	O
and	O
the	O
user	O
is	O
authenticated	O
.	O
</s>
<s>
In	O
theory	O
,	O
it	O
is	O
possible	O
for	O
two	O
different	O
passwords	O
to	O
produce	O
the	O
same	O
hash	B-Algorithm
.	O
</s>
<s>
However	O
,	O
cryptographic	B-Algorithm
hash	I-Algorithm
functions	I-Algorithm
are	O
designed	O
in	O
such	O
a	O
way	O
that	O
finding	O
any	O
password	O
that	O
produces	O
the	O
same	O
hash	B-Algorithm
is	O
very	O
difficult	O
and	O
practically	O
infeasible	O
,	O
so	O
if	O
the	O
produced	O
hash	B-Algorithm
matches	O
the	O
stored	O
one	O
,	O
the	O
user	O
can	O
be	O
authenticated	O
.	O
</s>
<s>
The	O
passwd	B-Protocol
command	B-Application
may	O
be	O
used	O
to	O
change	O
passwords	O
for	O
local	O
accounts	O
,	O
and	O
on	O
most	O
systems	O
,	O
can	O
also	O
be	O
used	O
to	O
change	O
passwords	O
managed	O
in	O
a	O
distributed	O
authentication	O
mechanism	O
such	O
as	O
NIS	B-Operating_System
,	O
Kerberos	B-Protocol
,	O
or	O
LDAP	B-Protocol
.	O
</s>
<s>
The	O
/etc/passwd	O
file	O
is	O
a	O
text-based	O
database	O
of	O
information	O
about	O
users	O
that	O
may	O
log	B-General_Concept
into	I-General_Concept
the	O
system	O
or	O
other	O
operating	B-General_Concept
system	I-General_Concept
user	O
identities	O
that	O
own	O
running	O
processes	O
.	O
</s>
<s>
In	O
many	O
operating	B-General_Concept
systems	I-General_Concept
this	O
file	O
is	O
just	O
one	O
of	O
many	O
possible	O
back-ends	B-Architecture
for	O
the	O
more	O
general	O
passwd	B-Protocol
name	I-Protocol
service	I-Protocol
.	O
</s>
<s>
However	O
,	O
on	O
modern	O
Unix	B-Application
systems	I-Application
the	O
security-sensitive	O
password	O
information	O
is	O
instead	O
often	O
stored	O
in	O
a	O
different	O
file	O
using	O
shadow	B-Protocol
passwords	I-Protocol
,	O
or	O
other	O
database	O
implementations	O
.	O
</s>
<s>
The	O
/etc/passwd	O
file	O
typically	O
has	O
file	O
system	O
permissions	O
that	O
allow	O
it	O
to	O
be	O
readable	O
by	O
all	O
users	O
of	O
the	O
system	O
(	O
world-readable	O
)	O
,	O
although	O
it	O
may	O
only	O
be	O
modified	O
by	O
the	O
superuser	B-Application
or	O
by	O
using	O
a	O
few	O
special	O
purpose	O
privileged	O
commands	O
.	O
</s>
<s>
The	O
/etc/passwd	O
file	O
is	O
a	O
text	B-General_Concept
file	I-General_Concept
with	O
one	O
record	O
per	O
line	B-General_Concept
,	O
each	O
describing	O
a	O
user	O
account	O
.	O
</s>
<s>
:	O
User	O
name	O
:	O
the	O
string	O
a	O
user	O
would	O
type	O
in	O
when	O
logging	O
into	O
the	O
operating	B-General_Concept
system	I-General_Concept
:	O
the	O
logname	B-Device
.	O
</s>
<s>
:	O
user	B-Application
identifier	I-Application
number	O
,	O
used	O
by	O
the	O
operating	B-General_Concept
system	I-General_Concept
for	O
internal	O
purposes	O
.	O
</s>
<s>
:	O
group	B-Application
identifier	I-Application
number	O
,	O
which	O
identifies	O
the	O
primary	O
group	O
of	O
the	O
user	O
;	O
all	O
files	O
that	O
are	O
created	O
by	O
this	O
user	O
may	O
initially	O
be	O
accessible	O
to	O
this	O
group	O
.	O
</s>
<s>
:	O
Gecos	B-Operating_System
field	I-Operating_System
,	O
commentary	O
that	O
describes	O
the	O
person	O
or	O
account	O
.	O
</s>
<s>
:	O
Path	O
to	O
the	O
user	O
's	O
home	B-Application
directory	I-Application
.	O
</s>
<s>
For	O
an	O
interactive	O
user	O
,	O
this	O
is	O
usually	O
one	O
of	O
the	O
system	O
's	O
command	B-Application
line	B-General_Concept
interpreters	O
(	O
shells	B-Operating_System
)	O
.	O
</s>
<s>
Typically	O
,	O
that	O
data	O
is	O
kept	O
in	O
files	O
owned	O
by	O
and	O
accessible	O
only	O
by	O
the	O
super	B-Application
user	I-Application
.	O
</s>
<s>
The	O
obvious	O
way	O
to	O
do	O
this	O
is	O
to	O
make	O
the	O
passwd	B-Protocol
database	O
itself	O
readable	O
only	O
by	O
the	O
root	B-Application
user	I-Application
.	O
</s>
<s>
However	O
,	O
this	O
would	O
restrict	O
access	O
to	O
other	O
data	O
in	O
the	O
file	O
such	O
as	O
username-to-userid	O
mappings	O
,	O
which	O
would	O
break	O
many	O
existing	O
utilities	O
and	O
provisions	O
.	O
</s>
<s>
One	O
solution	O
is	O
a	O
"	O
shadow	O
"	O
password	O
file	O
to	O
hold	O
the	O
password	B-Algorithm
hashes	I-Algorithm
separate	O
from	O
the	O
other	O
data	O
in	O
the	O
world-readable	O
passwd	B-Protocol
file	O
.	O
</s>
<s>
For	O
local	O
files	O
,	O
this	O
is	O
usually	O
/etc/shadow	O
on	O
Linux	B-Application
and	O
Unix	B-Application
systems	I-Application
,	O
or	O
/etc/master.passwd	O
on	O
BSD	B-Operating_System
systems	O
;	O
each	O
is	O
readable	O
only	O
by	O
root	O
.	O
</s>
<s>
(	O
Root	B-Application
access	I-Application
to	O
the	O
data	O
is	O
considered	O
acceptable	O
since	O
on	O
systems	O
with	O
the	O
traditional	O
"	O
all-powerful	O
root	O
"	O
security	O
model	O
,	O
the	O
root	B-Application
user	I-Application
would	O
be	O
able	O
to	O
obtain	O
the	O
information	O
in	O
other	O
ways	O
in	O
any	O
case	O
)	O
.	O
</s>
<s>
Virtually	O
all	O
recent	O
Unix-like	B-Operating_System
operating	I-Operating_System
systems	I-Operating_System
use	O
shadowed	B-Protocol
passwords	I-Protocol
.	O
</s>
<s>
The	O
shadow	O
password	O
file	O
does	O
not	O
entirely	O
solve	O
the	O
problem	O
of	O
attacker	O
access	O
to	O
hashed	O
passwords	O
,	O
as	O
some	O
network	O
authentication	O
schemes	O
operate	O
by	O
transmitting	O
the	O
hashed	O
password	O
over	O
the	O
network	O
(	O
sometimes	O
in	O
cleartext	O
,	O
e.g.	O
,	O
Telnet	B-Protocol
)	O
,	O
making	O
it	O
vulnerable	O
to	O
interception	O
.	O
</s>
<s>
Regardless	O
of	O
whether	O
password	B-Protocol
shadowing	I-Protocol
is	O
in	O
effect	O
on	O
a	O
given	O
system	O
,	O
the	O
passwd	B-Protocol
file	O
is	O
readable	O
by	O
all	O
users	O
so	O
that	O
various	O
system	O
utilities	O
(	O
e.g.	O
,	O
grep	B-Application
)	O
can	O
work	O
(	O
e.g.	O
,	O
to	O
ensure	O
that	O
user	O
names	O
existing	O
on	O
the	O
system	O
can	O
be	O
found	O
inside	O
the	O
file	O
)	O
,	O
while	O
only	O
the	O
root	B-Application
user	I-Application
can	O
write	O
to	O
it	O
.	O
</s>
<s>
Without	O
password	B-Protocol
shadowing	I-Protocol
,	O
this	O
means	O
that	O
an	O
attacker	O
with	O
unprivileged	O
access	O
to	O
the	O
system	O
can	O
obtain	O
the	O
hashed	O
form	O
of	O
every	O
user	O
's	O
password	O
.	O
</s>
<s>
Those	O
values	O
can	O
be	O
used	O
to	O
mount	O
a	O
brute	O
force	O
attack	O
offline	O
,	O
testing	O
possible	O
passwords	O
against	O
the	O
hashed	O
passwords	O
relatively	O
quickly	O
without	O
alerting	O
system	O
security	O
arrangements	O
designed	O
to	O
detect	O
an	O
abnormal	O
number	O
of	O
failed	O
login	B-General_Concept
attempts	O
.	O
</s>
<s>
Especially	O
when	O
the	O
hash	B-Algorithm
is	O
not	O
salted	O
it	O
is	O
also	O
possible	O
to	O
look	O
up	O
these	O
hashed	O
passwords	O
in	O
rainbow	B-Algorithm
tables	I-Algorithm
,	O
databases	O
specially	O
made	O
for	O
giving	O
back	O
a	O
password	O
for	O
a	O
unique	O
hash	B-Algorithm
.	O
</s>
<s>
With	O
a	O
shadowed	B-Protocol
password	I-Protocol
scheme	O
in	O
use	O
,	O
the	O
/etc/passwd	O
file	O
typically	O
shows	O
a	O
character	O
such	O
as	O
'	O
*	O
 '	O
,	O
or	O
'	O
x	O
 '	O
in	O
the	O
password	O
field	O
for	O
each	O
user	O
instead	O
of	O
the	O
hashed	O
password	O
,	O
and	O
/etc/shadow	O
usually	O
contains	O
the	O
following	O
user	O
information	O
:	O
</s>
<s>
$id$salt$hashed	O
,	O
the	O
printable	O
form	O
of	O
a	O
password	B-Algorithm
hash	I-Algorithm
as	O
produced	O
by	O
crypt	B-Algorithm
(	O
C	O
)	O
,	O
where	O
$id	O
is	O
the	O
algorithm	O
used	O
.	O
</s>
<s>
Other	O
Unix-like	B-Operating_System
systems	I-Operating_System
may	O
have	O
different	O
values	O
,	O
like	O
.	O
</s>
<s>
Key	O
stretching	O
is	O
used	O
to	O
increase	O
password	O
cracking	O
difficulty	O
,	O
using	O
by	O
default	O
1000	O
rounds	O
of	O
modified	O
MD5	B-Algorithm
,	O
64	O
rounds	O
of	O
Blowfish	B-Algorithm
,	O
5000	O
rounds	O
of	O
SHA-256	B-Algorithm
or	O
SHA-512	B-Algorithm
.	O
</s>
<s>
The	O
number	O
of	O
rounds	O
may	O
be	O
varied	O
for	O
,	O
or	O
for	O
SHA-256	B-Algorithm
and	O
SHA-512	B-Algorithm
by	O
using	O
$A$rounds	O
=	O
X$	O
,	O
where	O
"	O
A	O
"	O
and	O
"	O
X	O
"	O
are	O
the	O
algorithm	O
IDs	O
and	O
the	O
number	O
of	O
rounds	O
.	O
</s>
<s>
Empty	O
string	O
–	O
No	O
password	O
,	O
the	O
account	O
has	O
no	O
password	O
(	O
reported	O
by	O
passwd	B-Protocol
on	O
Solaris	O
with	O
"	O
NP	O
"	O
)	O
.	O
</s>
<s>
The	O
format	O
of	O
the	O
shadow	O
file	O
is	O
simple	O
,	O
and	O
basically	O
identical	O
to	O
that	O
of	O
the	O
password	O
file	O
,	O
to	O
wit	O
,	O
one	O
line	B-General_Concept
per	O
user	O
,	O
ordered	O
fields	O
on	O
each	O
line	B-General_Concept
,	O
and	O
fields	O
separated	O
by	O
colons	O
.	O
</s>
<s>
Prior	O
to	O
password	B-Protocol
shadowing	I-Protocol
,	O
a	O
Unix	B-Application
user	O
's	O
hashed	O
password	O
was	O
stored	O
in	O
the	O
second	O
field	O
of	O
their	O
record	O
in	O
the	O
/etc/passwd	O
file	O
(	O
within	O
the	O
seven-field	O
format	O
as	O
outlined	O
above	O
)	O
.	O
</s>
<s>
Password	B-Protocol
shadowing	I-Protocol
first	O
appeared	O
in	O
Unix	B-Application
systems	I-Application
with	O
the	O
development	O
of	O
SunOS	B-Operating_System
in	O
the	O
mid-1980s	O
,	O
System	O
V	O
Release	O
3.2	O
in	O
1988	O
and	O
BSD4.3	O
Reno	O
in	O
1990	O
.	O
</s>
<s>
But	O
,	O
vendors	O
who	O
had	O
performed	O
ports	O
from	O
earlier	O
UNIX	B-Application
releases	O
did	O
not	O
always	O
include	O
the	O
new	O
password	B-Protocol
shadowing	I-Protocol
features	O
in	O
their	O
releases	O
,	O
leaving	O
users	O
of	O
those	O
systems	O
exposed	O
to	O
password	O
file	O
attacks	O
.	O
</s>
<s>
System	O
administrators	O
may	O
also	O
arrange	O
for	O
the	O
storage	O
of	O
passwords	O
in	O
distributed	O
databases	O
such	O
as	O
NIS	B-Operating_System
and	O
LDAP	B-Protocol
,	O
rather	O
than	O
in	O
files	O
on	O
each	O
connected	O
system	O
.	O
</s>
<s>
In	O
the	O
case	O
of	O
NIS	B-Operating_System
,	O
the	O
shadow	O
password	O
mechanism	O
is	O
often	O
still	O
used	O
on	O
the	O
NIS	B-Operating_System
servers	O
;	O
in	O
other	O
distributed	O
mechanisms	O
the	O
problem	O
of	O
access	O
to	O
the	O
various	O
user	O
authentication	O
components	O
is	O
handled	O
by	O
the	O
security	O
mechanisms	O
of	O
the	O
underlying	O
data	O
repository	O
.	O
</s>
<s>
In	O
1987	O
,	O
the	O
author	O
of	O
the	O
original	O
Shadow	O
Password	O
Suite	O
,	O
Julie	O
Haugh	O
,	O
experienced	O
a	O
computer	O
break-in	O
and	O
wrote	O
the	O
initial	O
release	O
of	O
the	O
Shadow	O
Suite	O
containing	O
the	O
login	B-General_Concept
,	O
passwd	B-Protocol
and	O
su	B-Device
commands	O
.	O
</s>
<s>
The	O
original	O
release	O
,	O
written	O
for	O
the	O
SCO	B-Application
Xenix	I-Application
operating	B-General_Concept
system	I-General_Concept
,	O
quickly	O
got	O
ported	O
to	O
other	O
platforms	O
.	O
</s>
<s>
The	O
Shadow	O
Suite	O
was	O
ported	O
to	O
Linux	B-Application
in	O
1992	O
one	O
year	O
after	O
the	O
original	O
announcement	O
of	O
the	O
Linux	B-Application
project	O
,	O
and	O
was	O
included	O
in	O
many	O
early	O
distributions	O
,	O
and	O
continues	O
to	O
be	O
included	O
in	O
many	O
current	O
Linux	B-Application
distributions	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
command	B-Application
to	O
change	O
a	O
NIS	B-Operating_System
password	O
was	O
yppasswd	O
.	O
</s>
<s>
This	O
required	O
users	O
to	O
be	O
aware	O
of	O
the	O
different	O
methods	O
to	O
change	O
passwords	O
for	O
different	O
systems	O
,	O
and	O
also	O
resulted	O
in	O
wasteful	O
duplication	O
of	O
code	O
in	O
the	O
various	O
programs	O
that	O
performed	O
the	O
same	O
functions	O
with	O
different	O
back	B-Architecture
ends	I-Architecture
.	O
</s>
<s>
In	O
most	O
implementations	O
,	O
there	O
is	O
now	O
a	O
single	O
passwd	B-Protocol
command	B-Application
,	O
and	O
the	O
control	O
of	O
where	O
the	O
password	O
is	O
actually	O
changed	O
is	O
handled	O
transparently	O
to	O
the	O
user	O
via	O
pluggable	B-Application
authentication	I-Application
modules	I-Application
(	O
PAMs	O
)	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
type	O
of	O
hash	B-Algorithm
used	O
is	O
dictated	O
by	O
the	O
configuration	O
of	O
the	O
pam_unix.so	O
module	O
.	O
</s>
<s>
By	O
default	O
,	O
the	O
MD5	B-Algorithm
hash	I-Algorithm
has	O
been	O
used	O
,	O
while	O
current	O
modules	O
are	O
also	O
capable	O
of	O
stronger	O
hashes	B-Algorithm
such	O
as	O
blowfish	B-Algorithm
,	O
SHA256	B-Algorithm
and	O
SHA512	B-Algorithm
.	O
</s>
