<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://hackepedia.org/index.php?action=history&amp;feed=atom&amp;title=Shadow_passwords</id>
	<title>Shadow passwords - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://hackepedia.org/index.php?action=history&amp;feed=atom&amp;title=Shadow_passwords"/>
	<link rel="alternate" type="text/html" href="https://hackepedia.org/index.php?title=Shadow_passwords&amp;action=history"/>
	<updated>2026-05-08T18:07:30Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://hackepedia.org/index.php?title=Shadow_passwords&amp;diff=3611&amp;oldid=prev</id>
		<title>Hawson: Initial version</title>
		<link rel="alternate" type="text/html" href="https://hackepedia.org/index.php?title=Shadow_passwords&amp;diff=3611&amp;oldid=prev"/>
		<updated>2007-05-14T19:31:15Z</updated>

		<summary type="html">&lt;p&gt;Initial version&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Shadow passwords are an extension to storing all account information in the &amp;lt;code&amp;gt;/etc/passwd&amp;lt;/code&amp;gt; file.  Originally, the encrypted passwords for all accounts were kept in the 2nd field of &amp;lt;code&amp;gt;/etc/passwd&amp;lt;/code&amp;gt;.  Since this file needs to be world-readable in order to obtain information about accounts (including the username, [[UID]], primary [[GID]], [[GECOS]] information, home directory, and user shell), it meant that the encrypted passwords were also viewable.  This provided a very nice known-ciphertext attack vector.&lt;br /&gt;
&lt;br /&gt;
An extenstion was developed that addressed this insecurity, and added password and account aging abilities as well.   All modern *nix distributions support shadow passwords, in addition to original method.&lt;br /&gt;
&lt;br /&gt;
Aside from re-writing the [[PAM]] code, the main userspace change is the addition of &amp;lt;code&amp;gt;/etc/shadow&amp;lt;/code&amp;gt;, and several tools for manipulating this file.  Unlike &amp;lt;code&amp;gt;/etc/passwd&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;/etc/shadow&amp;lt;/code&amp;gt; file must not be world-readable (suggested mode is 600).  Of course, this means that all programs that read and write this file must be either [[setuid]], or run by the root user; this includes common &amp;quot;user&amp;quot; programs such as &amp;quot;passwd&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This file stores the data for the following struct:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;struct spwd {&lt;br /&gt;
    char *sp_namp;   /* user login name */&lt;br /&gt;
    char *sp_pwdp;   /* encrypted password */&lt;br /&gt;
    long  sp_lstchg; /* last password change */&lt;br /&gt;
    int   sp_min;    /* days until change allowed. */&lt;br /&gt;
    int   sp_max;    /* days before change required */&lt;br /&gt;
    int   sp_warn;   /* days warning for expiration */&lt;br /&gt;
    int   sp_inact;  /* days before account inactive */&lt;br /&gt;
    int   sp_expire; /* date when account expires */&lt;br /&gt;
    int   sp_flag;   /* reserved for future use */&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The timing of the dates and times stored here can cause some confusion.  The following timeline should help show when things occur:&lt;br /&gt;
&lt;br /&gt;
[[image:Shadow_pw.png|Shadow password timeline]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;N.B.:  The &amp;quot;account expire&amp;quot; date can occur anywhere, including before the password expiration, password last-change, and account inactive dates.&amp;#039;&amp;#039;&amp;#039;&lt;/div&gt;</summary>
		<author><name>Hawson</name></author>
	</entry>
</feed>