1<HTML> 2<HEAD> 3<TITLE> 4[Chapter 6] 6.4 Passwords</title><META NAME="DC.title" CONTENT=""><META NAME="DC.creator" CONTENT=""><META NAME="DC.publisher" CONTENT="O'Reilly & Associates, Inc."><META NAME="DC.date" CONTENT="1999-11-05T21:33:50Z"><META NAME="DC.type" CONTENT="Text.Monograph"><META NAME="DC.format" CONTENT="text/html" SCHEME="MIME"><META NAME="DC.source" CONTENT="" SCHEME="ISBN"><META NAME="DC.language" CONTENT="en-US"><META NAME="generator" CONTENT="Jade 1.1/O'Reilly DocBook 3.0 to HTML 4.0"></head> 5<BODY BGCOLOR="#FFFFFF" TEXT="#000000" link="#990000" vlink="#0000CC"> 6<table BORDER="0" CELLPADDING="0" CELLSPACING="0" width="90%"> 7<tr> 8<td width="25%" valign="TOP"> 9<img hspace=10 vspace=10 src="gifs/samba.s.gif" 10alt="Using Samba" align=left valign=top border=0> 11</td> 12<td height="105" valign="TOP"> 13<br> 14<H2>Using Samba</H2> 15<font size="-1"> 16Robert Eckstein, David Collier-Brown, Peter Kelly 17<br>1st Edition November 1999 18<br>1-56592-449-5, Order Number: 4495 19<br>416 pages, $34.95 20</font> 21<p> <a href="http://www.oreilly.com/catalog/samba/">Buy the hardcopy</a> 22<p><a href="index.html">Table of Contents</a> 23</td> 24</tr> 25</table> 26<hr size=1 noshade> 27<!--sample chapter begins --> 28 29<center> 30<DIV CLASS="htmlnav"> 31<TABLE WIDTH="515" BORDER="0" CELLSPACING="0" CELLPADDING="0"> 32<TR> 33<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172"> 34<A CLASS="sect1" HREF="ch06_03.html" TITLE="6.3 Authentication Security"> 35<IMG SRC="gifs/txtpreva.gif" ALT="Previous: 6.3 Authentication Security" BORDER="0"></a></td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171"> 36<B> 37<FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1"> 38<A CLASS="chapter" REL="up" HREF="ch06_01.html" TITLE="6. Users, Security, and Domains "> 39Chapter 6<br> 40Users, Security, and Domains </a></font></b></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172"> 41<A CLASS="sect1" HREF="ch06_05.html" TITLE="6.5 Windows Domains"> 42<IMG SRC="gifs/txtnexta.gif" ALT="Next: 6.5 Windows Domains" BORDER="0"></a></td></tr></table> <hr noshade size=1></center> 43</div> 44<blockquote> 45<div> 46<H2 CLASS="sect1"> 47<A CLASS="title" NAME="ch06-61393"> 486.4 Passwords</a></h2><P CLASS="para">Passwords are a thorny issue with Samba. So much so, in fact, that they are almost always the first major problem that users encounter when they install Samba, and generate by far the most questions sent to Samba support groups. In previous chapters, we've gotten around the need for passwords by placing the <CODE CLASS="literal"> 49guest</code> <CODE CLASS="literal"> 50ok</code> option in each of our configuration files, which allows connections without authenticating passwords. However, at this point, we need to delve deeper into Samba to discover what is happening on the network.</p><P CLASS="para">Passwords sent from individual clients can be either encrypted or non-encrypted. Encrypted passwords are, of course, more secure. A non-encrypted password can be easily read with a packet sniffing program, such as the modified <EM CLASS="emphasis"> 51tcpdump</em> program for Samba that we used in <a href="ch03_01.html"><b>Chapter 3, <CITE CLASS="chapter">Configuring Windows Clients</cite></b></a>. Whether passwords are encrypted depends on the operating system that the client is using to connect to the Samba server. <A CLASS="xref" HREF="ch06_04.html#ch06-75183"> 52Table 6.5</a> lists which Windows operating systems encrypt their passwords before sending them to the primary domain controller for authentication. If your client is not Windows, check the system documentation to see if SMB passwords are encrypted. </p><br> 53<TABLE CLASS="table" BORDER="1" CELLPADDING="3"> 54<CAPTION CLASS="table"> 55<A CLASS="title" NAME="ch06-75183"> 56Table 6.5: Windows Operating Systems with Encrypted Passwords </a></caption><THEAD CLASS="thead"> 57<TR CLASS="row" VALIGN="TOP"> 58<TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 59<P CLASS="para"> 60Operating System</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 61<P CLASS="para"> 62Encrypted or Non-encrypted</p></th></tr></thead><TBODY CLASS="tbody"> 63<TR CLASS="row" VALIGN="TOP"> 64<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 65<P CLASS="para"> 66<CODE CLASS="literal"> 67</code>Windows 95</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 68<P CLASS="para"> 69Non-encrypted</p></td></tr><TR CLASS="row" VALIGN="TOP"> 70<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 71<P CLASS="para"> 72Windows 95 with SMB Update</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 73<P CLASS="para"> 74Encrypted</p></td></tr><TR CLASS="row" VALIGN="TOP"> 75<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 76<P CLASS="para"> 77Windows 98</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 78<P CLASS="para"> 79Encrypted</p></td></tr><TR CLASS="row" VALIGN="TOP"> 80<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 81<P CLASS="para"> 82Windows NT 3.<EM CLASS="emphasis"> 83x</em></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 84<P CLASS="para"> 85Non-encrypted</p></td></tr><TR CLASS="row" VALIGN="TOP"> 86<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 87<P CLASS="para"> 88Windows NT 4.0 before SP<CODE CLASS="literal"> 89 3</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 90<P CLASS="para"> 91Non-encrypted</p></td></tr><TR CLASS="row" VALIGN="TOP"> 92<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 93<P CLASS="para"> 94Windows NT 4.0 after SP 3</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 95<P CLASS="para"> 96Encrypted</p></td></tr></tbody></table><P CLASS="para"> 97There are actually two different encryption methods used: one for Windows 95 and 98 clients that reuses Microsoft's LAN Manager encryption style, and a separate one for Windows NT clients and servers. Windows 95 and 98 use an older encryption system inherited from the LAN Manager network software, while Windows NT clients and servers use a newer encryption system.</p><P CLASS="para"> 98If encrypted passwords are supported, Samba stores the encrypted passwords in a file called <I CLASS="filename"> 99smbpasswd</i>. By default, this file is located in the <I CLASS="filename"> 100private</i> directory of the Samba distribution (<I CLASS="filename">/usr/local/samba/private</i>). At the same time, the client stores an encrypted version of a user's password on its own system. The plaintext password is never stored on either system. Each system encrypts the password automatically using a known algorithm when the password is set or changed.</p><P CLASS="para"> 101When a client requests a connection to an SMB server that supports encrypted passwords (such as Samba or Windows NT), the two computers undergo the following negotiations:</p><OL CLASS="orderedlist"> 102<LI CLASS="listitem"> 103<P CLASS="para"> 104<A CLASS="listitem" NAME="ch06-pgfId-957427"> 105</a>The client attempts to negotiate a protocol with the server.</p></li><LI CLASS="listitem"> 106<P CLASS="para"> 107<A CLASS="listitem" NAME="ch06-pgfId-957428"> 108</a>The server responds with a protocol and indicates that it supports encrypted passwords. At this time, it sends back a randomly-generated 8-byte challenge string.</p></li><LI CLASS="listitem"> 109<P CLASS="para"> 110<A CLASS="listitem" NAME="ch06-pgfId-957433"> 111</a>The client uses the challenge string as a key to encrypt its already encrypted password using an algorithm predefined by the negotiated protocol. It then sends the result to the server.</p></li><LI CLASS="listitem"> 112<P CLASS="para"> 113<A CLASS="listitem" NAME="ch06-pgfId-957436"> 114</a>The server does the same thing with the encrypted password stored in its database. If the results match, the passwords are equivalent and the user is authenticated.</p></li></ol><P CLASS="para"> 115Note that even though the original passwords are not involved in the authentication process, you need to be very careful that the encrypted passwords located inside of the <I CLASS="filename"> 116smbpasswd</i> file are guarded from unauthorized users. If they are compromised, an unauthorized user can break into the system by replaying the steps of the previous algorithm. The encrypted passwords are just as sensitive as the plaintext passwords - this is known as <I CLASS="firstterm"> 117plaintext-equivalent</i> data in the cryptography world. Of course, you should also ensure that the clients safeguard their plaintext-equivalent passwords as well.</p><P CLASS="para"> 118You can configure Samba to accept encrypted passwords with the following global additions to <I CLASS="filename"> 119smb.conf</i>. Note that we explicitly name the location of the Samba password file:</p><PRE CLASS="programlisting"> 120[global] 121 security = user 122 encrypt passwords = yes 123 smb passwd file = /usr/local/samba/private/smbpasswd</pre><P CLASS="para"> 124Samba, however, will not accept any users until the <I CLASS="filename"> 125smbpasswd</i> file has been initialized.</p><DIV CLASS="sect2"> 126<H3 CLASS="sect2"> 127<A CLASS="title" NAME="ch06-pgfId-959309"> 1286.4.1 Disabling encrypted passwords on the client</a></h3><P CLASS="para">While Unix authentication has been in use for decades, including the use of <EM CLASS="emphasis"> 129telnet</em> and <EM CLASS="emphasis"> 130rlogin</em> access across the Internet, it embodies well-known security risks. Plaintext passwords are sent over the Internet and can be retrieved from TCP packets by malicious snoopers. However, if you feel that your network is secure and you wish to use standard Unix <I CLASS="filename"> 131/etc/passwd</i> authentication for all clients, you can do so, but you must disable encrypted passwords on those Windows clients that default to using them. </p><P CLASS="para"> 132In order to do this, you must modify the Windows registry by installing two files on each system. Depending on the platform involved, the files are either <I CLASS="filename"> 133NT4_PlainPassword.reg</i> or <I CLASS="filename"> 134Win95_PlainPassword.reg</i>. You can perform this installation by copying the appropriate <I CLASS="filename"> 135.reg</i> files from the Samba distribution's <I CLASS="filename"> 136/docs</i> directory to a DOS floppy, and running it from the Run menu item on the client's Start Menu button. Incidentally, the Windows 95 <I CLASS="filename"> 137.reg</i> file works fine on Windows 98 as well.</p><P CLASS="para"> 138After you reboot the machine, the client will not encrypt its hashed passwords before sending them to the server. This means that the plaintext-equivalent passwords can been seen in the TCP packets that are broadcast across the network. Again, we encourage you not to do this unless you are absolutely sure that your network is secure.</p><P CLASS="para"> 139If passwords are not encrypted, you can indicate as much in your Samba configuration file:</p><PRE CLASS="programlisting"> 140[global] 141 security = user 142 encrypt passwords = no</pre></div><DIV CLASS="sect2"> 143<H3 CLASS="sect2"> 144<A CLASS="title" NAME="ch06-17782"> 1456.4.2 The smbpasswd File</a></h3><P CLASS="para"> 146<I CLASS="filename"> 147</i>Samba stores its encrypted passwords in a file called <I CLASS="filename"> 148smbpasswd</i>, which by default resides in the <I CLASS="filename"> 149/usr/local/samba/private</i> directory. The <I CLASS="filename"> 150smbpasswd</i> file should be guarded as closely as the <I CLASS="filename"> 151passwd</i> file; it should be placed in a directory to which only the root user has read/write access. All other users should not be able to read from the directory at all. In addition, the file should have all access closed off to all users except for root.</p><P CLASS="para"> 152Before you can use encrypted passwords, you will need to create an entry for each Unix user in the <I CLASS="filename"> 153smbpasswd</i> file. The structure of the file is somewhat similar to a Unix <I CLASS="filename"> 154passwd</i> file, but has different fields. <A CLASS="xref" HREF="ch06_04.html#ch06-54128"> 155Figure 6.3</a> illustrates the layout of the <I CLASS="filename"> 156smbpasswd</i> file; the entry shown is actually one line in the file. </p><H4 CLASS="figure"> 157<A CLASS="title" NAME="ch06-54128"> 158Figure 6.3: Structure of the smbpasswd file entry (actually one line)</a></h4><IMG CLASS="graphic" SRC="figs/sam.0603.gif" ALT="Figure 6.3"><P CLASS="para"> 159Here is a breakdown of the individual fields:</p><DL CLASS="variablelist"> 160<DT CLASS="term"> 161Username</dt><DD CLASS="listitem"> 162<P CLASS="para"> 163This is the username of the account. It is taken directly from the system password file.</p></dd><DT CLASS="term"> 164UID</dt><DD CLASS="listitem"> 165<P CLASS="para"> 166This is the user ID of the account. Like the username, it is taken directly from the system password file and must match the user it represents there.</p></dd><DT CLASS="term"> 167LAN Manager Password Hash</dt><DD CLASS="listitem"> 168<P CLASS="para"> 169This is a 32-bit hexadecimal sequence that represents the password Windows 95 and 98 clients will use. It is derived by encrypting the string <CODE CLASS="literal"> 170KGS!@#$%</code> with a 56-bit DES algorithm using the user's password (forced to 14 bytes and converted to capital letters) twice repeated as the key. If there is currently no password for this user, the first 11 characters of the hash will consist of the sequence <CODE CLASS="literal"> 171NO</code> <CODE CLASS="literal"> 172PASSWORD</code> followed by <CODE CLASS="literal"> 173X</code> characters for the remainder. Anyone can access the share with no password. On the other hand, if the password has been disabled, it will consist of 32 <CODE CLASS="literal"> 174X</code> characters. Samba will not grant access to a user without a password unless the <CODE CLASS="literal"> 175null</code> <CODE CLASS="literal"> 176passwords</code> option has been set.</p></dd><DT CLASS="term"> 177NT Password Hash</dt><DD CLASS="listitem"> 178<P CLASS="para"> 179This is a 32-bit hexadecimal sequence that represents the password Windows NT clients will use. It is derived by hashing the user's password (represented as a 16-bit little-endian Unicode sequence) with an MD4 hash. The password is not converted to uppercase letters first.</p></dd><DT CLASS="term"> 180Account Flags</dt><DD CLASS="listitem"> 181<P CLASS="para"> 182This field consists of 11 characters between two braces ([]). Any of the following characters can appear in any order; the remaining characters should be spaces:</p><P CLASS="para"> 183U</p><P CLASS="para"> 184This account is a standard user account.</p><P CLASS="para"> 185D</p><P CLASS="para"> 186This account is currently disabled and Samba should not allow any logins.</p><P CLASS="para"> 187N</p><P CLASS="para"> 188This account has no password associated with it.</p><P CLASS="para"> 189W</p><P CLASS="para"> 190This is a workstation trust account that can be used to configure Samba as a primary domain controller (PDC) when allowing Windows NT machines to join its domain.</p></dd></dl><DL CLASS="variablelist"> 191<DT CLASS="term"> 192Last Change Time</dt><DD CLASS="listitem"> 193<P CLASS="para"> 194This code consists of the characters <CODE CLASS="literal"> 195LCT-</code> followed by a hexidecimal representation of the amount of seconds since the epoch (midnight on January 1, 1970) that the entry was last changed.</p></dd></dl><DIV CLASS="sect3"> 196<H4 CLASS="sect3"> 197<A CLASS="title" NAME="ch06-pgfId-957988"> 1986.4.2.1 Adding entries to smbpasswd</a></h4><P CLASS="para"> 199<I CLASS="filename"> 200</i>There are a few ways you can add a new entry to the <I CLASS="filename"> 201smbpasswd</i> file:</p><UL CLASS="itemizedlist"> 202<LI CLASS="listitem"> 203<P CLASS="para"> 204<A CLASS="listitem" NAME="ch06-pgfId-961684"> 205</a>You can use the <I CLASS="firstterm"> 206smbpasswd</i> program with the <CODE CLASS="literal"> 207-a</code> option to automatically add any user that currently has a standard Unix system account on the server. This program resides in the <I CLASS="filename"> 208/usr/local/samba/bin</i> directory.</p></li><LI CLASS="listitem"> 209<P CLASS="para"> 210<A CLASS="listitem" NAME="ch06-pgfId-957867"> 211</a>You can use the <I CLASS="firstterm"> 212addtosmbpass</i> executable inside the <I CLASS="firstterm"> 213/usr/local/samba/bin</i> directory. This is actually a simple <EM CLASS="emphasis"> 214awk</em> script that parses a system password file and extracts the username and UID of each entry you wish to add to the SMB password file. It then adds default fields for the remainder of the user's entry, which can be updated using the <I CLASS="filename"> 215smbpasswd</i> program later. In order to use this program, you will probably need to edit the first line of the file to correctly point to <EM CLASS="emphasis"> 216awk</em> on your system.</p></li><LI CLASS="listitem"> 217<P CLASS="para"> 218<A CLASS="listitem" NAME="ch06-pgfId-957870"> 219</a>In the event that the neither of those options work for you, you can create a default entry by hand in the <I CLASS="filename"> 220smbpasswd</i> file. The entry should be entirely on one line. Each field should be colon-separated and should look similar to the following:</p></li></ul><PRE CLASS="programlisting"> 221dave:500:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:[U ]:LCT-00000000:</pre><P CLASS="para"> 222This consists of the username and the UID as specified in the system password file, followed by two sets of exactly 32 <CODE CLASS="literal"> 223X</code> characters, followed by the account flags and last change time as it appears above. After you've added this entry, you must use the <I CLASS="firstterm"> 224smbpasswd</i> program to change the password for the user.</p></div><DIV CLASS="sect3"> 225<H4 CLASS="sect3"> 226<A CLASS="title" NAME="ch06-pgfId-958012"> 2276.4.2.2 Changing the encrypted password</a></h4><P CLASS="para">If you need to change the encrypted password in the <I CLASS="filename"> 228smbpasswd</i> file, you can also use the <I CLASS="filename"> 229smbpasswd</i> program. Note that this program shares the same name as the encrypted password file itself, so be sure not to accidentally confuse the password file with the password-changing program.</p><P CLASS="para"> 230The <I CLASS="filename"> 231smbpasswd</i> program is almost identical to the <I CLASS="filename"> 232passwd</i> program that is used to change Unix account passwords. The program simply asks you to enter your old password (unless you're the root user), and duplicate entries of your new password. No password characters are shown on the screen. </p><PRE CLASS="programlisting"><B CLASS="emphasis.bold"><CODE CLASS="literal">#</code> smbpasswd dave</b> 233</pre><PRE CLASS="programlisting"> 234Old SMB password: 235New SMB password: 236Retype new SMB password: 237Password changed for user dave</pre><P CLASS="para"> 238You can look at the <I CLASS="filename"> 239smbpasswd</i> file after this command completes to verify that both the LAN Manager and the NT hashes of the passwords have been stored in their respective positions. Once users have encrypted password entries in the database, they should be able to connect to shares using encrypted passwords!<I CLASS="filename"> 240</i> </p></div></div><DIV CLASS="sect2"> 241<H3 CLASS="sect2"> 242<A CLASS="title" NAME="ch06-97004"> 2436.4.3 Password Synchronization</a></h3><P CLASS="para">Having a regular password and an encrypted version of the same password can be troublesome when you need to change both of them. Luckily, Samba affords you a limited ability to keep your passwords synchronized. Samba has a pair of configuration options that can be used to automatically update a user's regular Unix password when the encrypted password is changed on the system. The feature can be activated by specifying the <CODE CLASS="literal"> 244unix</code> <CODE CLASS="literal"> 245password</code> <CODE CLASS="literal"> 246sync</code> global configuration option:</p><PRE CLASS="programlisting"> 247[global] 248 encrypt passwords = yes 249 smb passwd file = /usr/local/samba/private/smbpasswd 250 251 unix password sync = yes</pre><P CLASS="para"> 252With this option enabled, Samba will attempt to change the user's regular password (as <CODE CLASS="literal"> 253root</code>) when the encrypted version is changed with <I CLASS="filename"> 254smbpasswd</i>. However, there are two other options that have to be set correctly in order for this to work.</p><P CLASS="para"> 255The easier of the two is <CODE CLASS="literal"> 256passwd</code> <CODE CLASS="literal"> 257program</code>. This option simply specifies the Unix command used to change a user's standard system password. It is set to <CODE CLASS="literal"> 258/bin/passw</code>d <CODE CLASS="literal"> 259%u</code> by default. With some Unix systems, this is sufficient and you do not need to change anything. Others, such as Red Hat Linux, use <I CLASS="filename"> 260/usr/bin/passwd</i> instead. In addition, you may want to change this to another program or script at some point in the future. For example, let's assume that you want to use a script called <CODE CLASS="literal"> 261changepass</code> to change a user's password. Recall that you can use the variable <CODE CLASS="literal"> 262%u</code> to represent the current Unix username. So the example becomes:</p><PRE CLASS="programlisting"> 263[global] 264 encrypt passwords = yes 265 smb passwd file = /usr/local/samba/private/smbpasswd 266 267 unix password sync = yes 268 passwd program = changepass %u</pre><P CLASS="para"> 269Note that this program will be called as the <CODE CLASS="literal"> 270root</code> user when the <CODE CLASS="literal"> 271unix</code> <CODE CLASS="literal"> 272password</code> <CODE CLASS="literal"> 273sync</code> option is set to <CODE CLASS="literal"> 274yes</code>. This is because Samba does not necessarily have the plaintext old password of the user. </p><P CLASS="para"> 275The harder option to configure is <CODE CLASS="literal"> 276passwd</code> <CODE CLASS="literal"> 277chat</code>. The <CODE CLASS="literal"> 278passwd</code> <CODE CLASS="literal"> 279chat</code> option works like a Unix chat script. It specifies a series of strings to send as well as responses to expect from the program specified by the <CODE CLASS="literal"> 280passwd</code> <CODE CLASS="literal"> 281program</code> option. For example, this is what the default <CODE CLASS="literal"> 282passwd</code> <CODE CLASS="literal"> 283chat</code> looks like. The delimiters are the spaces between each groupings of characters:</p><PRE CLASS="programlisting"> 284passwd chat = *old*password* %o\n *new*password* %n\n *new*password* %n\n *changed*</pre><P CLASS="para"> 285The first grouping represents a response expected from the password-changing program. Note that it can contain wildcards (*), which help to generalize the chat programs to be able to handle a variety of similar outputs. Here, <CODE CLASS="literal"> 286*old*password*</code> indicates that Samba is expecting any line from the password program containing the letters <CODE CLASS="literal"> 287old</code> followed by the letters <CODE CLASS="literal"> 288password</code>, without regard for what comes on either side or between them. Once instructed to, Samba will wait indefinitely for such a match. Is Samba does not receive the expected response, the password will fail.</p><P CLASS="para"> 289The second grouping indicates what Samba should send back once the data in the first grouping has been matched. In this case, you see <CODE CLASS="literal"> 290%o\n</code>. This response is actually two items: the variable <CODE CLASS="literal"> 291%o</code> represents the old password, while the <CODE CLASS="literal"> 292\n</code> is a newline character. So, in effect, this will "type" the old password into the standard input of the password changing program, and then "press" Enter.</p><P CLASS="para"> 293Following that is another response grouping, followed by data that will be sent back to the password changing program. (In fact, this response/send pattern continues indefinitely in any standard Unix <EM CLASS="emphasis"> 294chat</em> script.) The script continues until the final pattern is matched.[<A CLASS="footnote" HREF="#ch06-pgfId-969009">2</a>]</p><BLOCKQUOTE CLASS="footnote"> 295<DIV CLASS="footnote"> 296<P CLASS="para"> 297<A CLASS="footnote" NAME="ch06-pgfId-969009">[2]</a> This may not work under Red Hat Linux, as the password program typically responds "All authentication tokens updated successfully," instead of "Password changed." We provide a fix for this later in this section.</p></div></blockquote><P CLASS="para"> 298You can help match the response strings sent from the password program with the characters listed in <A CLASS="xref" HREF="ch06_04.html#ch06-77246"> 299Table 6.6</a>. In addition, you can use the characters listed in <A CLASS="xref" HREF="ch06_04.html#ch06-38512"> 300Table 6.7</a> to help formulate your response. </p><br> 301<TABLE CLASS="table" BORDER="1" CELLPADDING="3"> 302<CAPTION CLASS="table"> 303<A CLASS="title" NAME="ch06-77246"> 304Table 6.6: Password Chat Response Characters </a></caption><THEAD CLASS="thead"> 305<TR CLASS="row" VALIGN="TOP"> 306<TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 307<P CLASS="para"> 308Character</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 309<P CLASS="para"> 310Definition</p></th></tr></thead><TBODY CLASS="tbody"> 311<TR CLASS="row" VALIGN="TOP"> 312<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 313<P CLASS="para"> 314<CODE CLASS="literal"> 315*</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 316<P CLASS="para">Zero or more occurrences of any character.</p></td></tr><TR CLASS="row" VALIGN="TOP"> 317<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 318<P CLASS="para"> 319<CODE CLASS="literal"> 320" "</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 321<P CLASS="para"> 322Allows you to include matching strings that contain spaces. Asterisks are still considered wildcards even inside of quotes, and you can represent a null response with empty quotes.</p></td></tr></tbody></table><br> 323<TABLE CLASS="table" BORDER="1" CELLPADDING="3"> 324<CAPTION CLASS="table"> 325<A CLASS="title" NAME="ch06-38512"> 326Table 6.7: Password Chat Send Characters </a></caption><THEAD CLASS="thead"> 327<TR CLASS="row" VALIGN="TOP"> 328<TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 329<P CLASS="para"> 330Character</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 331<P CLASS="para"> 332Definition</p></th></tr></thead><TBODY CLASS="tbody"> 333<TR CLASS="row" VALIGN="TOP"> 334<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 335<P CLASS="para"> 336<CODE CLASS="literal"> 337%o</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 338<P CLASS="para"> 339The user's old password</p></td></tr><TR CLASS="row" VALIGN="TOP"> 340<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 341<P CLASS="para"> 342<CODE CLASS="literal"> 343%n</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 344<P CLASS="para"> 345The user's new password</p></td></tr><TR CLASS="row" VALIGN="TOP"> 346<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 347<P CLASS="para"> 348<CODE CLASS="literal"> 349\n</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 350<P CLASS="para"> 351The linefeed character</p></td></tr><TR CLASS="row" VALIGN="TOP"> 352<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 353<P CLASS="para"> 354<CODE CLASS="literal"> 355\r</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 356<P CLASS="para"> 357The carriage-return character</p></td></tr><TR CLASS="row" VALIGN="TOP"> 358<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 359<P CLASS="para"> 360<CODE CLASS="literal"> 361\t</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 362<P CLASS="para"> 363The tab character</p></td></tr><TR CLASS="row" VALIGN="TOP"> 364<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 365<P CLASS="para"> 366<CODE CLASS="literal"> 367\s</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 368<P CLASS="para"> 369A space</p></td></tr></tbody></table><P CLASS="para"> 370For example, you may want to change your password chat to the following entry. This will handle scenarios in which you do not have to enter the old password. In addition, this will also handle the new <CODE CLASS="literal"> 371all</code> <CODE CLASS="literal"> 372tokens</code> <CODE CLASS="literal"> 373updated</code> <CODE CLASS="literal"> 374successfully</code> string that Red Hat Linux sends:</p><PRE CLASS="programlisting"> 375passwd chat = *new password* %n\n *new password* %n\n *success*</pre><P CLASS="para"> 376Again, the default chat should be sufficient for many Unix systems. If it isn't, you can use the <CODE CLASS="literal"> 377passwd</code> <CODE CLASS="literal"> 378chat</code> <CODE CLASS="literal"> 379debug</code> global option to set up a new chat script for the password change program. The <CODE CLASS="literal"> 380passwd</code> <CODE CLASS="literal"> 381chat</code> <CODE CLASS="literal"> 382debug</code> option logs everything during a password chat. This option is a simple boolean, as shown below:</p><PRE CLASS="programlisting"> 383[global] 384 encrypted passwords = yes 385 smb passwd file = /usr/local/samba/private/smbpasswd 386 387 unix password sync = yes 388 passwd chat debug = yes 389 log level = 100</pre><P CLASS="para"> 390After you activate the password chat debug feature, all I/O received by Samba through the password chat will be sent to the Samba logs with a debug level of 100, which is why we entered a new log level option as well. As this can often generate multitudes of error logs, it may be more efficient to use your own script, by setting the <CODE CLASS="literal"> 391passwd</code> <CODE CLASS="literal"> 392program</code> option, in place of <I CLASS="filename"> 393/bin/passwd</i> to record what happens during the exchange. Also, make sure to protect your log files with strict file permissions and to delete them as soon as you've grabbed the information you need, because they contain the passwords in plaintext.</p><P CLASS="para"> 394The operating system on which Samba is running may have strict requirements for valid passwords in order to make them more impervious to dictionary attacks and the like. Users should be made aware of these restrictions when changing their passwords.</p><P CLASS="para"> 395Earlier we said that password synchronization is limited. This is because there is no reverse synchronization of the encrypted <I CLASS="filename"> 396smbpasswd</i> file when a standard Unix password is updated by a user. There are various strategies to get around this, including NIS and freely available implementations of the pluggable authentication modules (PAM) standard, but none of them really solve all the problems yet. In the future, when Windows 2000 emerges, we will see more compliance with the Lightweight Directory Access Protocol (LDAP), which promises to make password synchronization a thing of the past. </p></div><DIV CLASS="sect2"> 397<H3 CLASS="sect2"> 398<A CLASS="title" NAME="ch06-pgfId-958652"> 3996.4.4 Password Configuration Options</a></h3><P CLASS="para"> 400The options in <A CLASS="xref" HREF="ch06_04.html#ch06-68460"> 401Table 6.8</a> will help you work with passwords in Samba. </p><br> 402<TABLE CLASS="table" BORDER="1" CELLPADDING="3"> 403<CAPTION CLASS="table"> 404<A CLASS="title" NAME="ch06-68460"> 405Table 6.8: Password Configuration Options </a></caption><THEAD CLASS="thead"> 406<TR CLASS="row" VALIGN="TOP"> 407<TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 408<P CLASS="para"> 409Option</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 410<P CLASS="para"> 411Parameters</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 412<P CLASS="para"> 413Function</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 414<P CLASS="para"> 415Default</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 416<P CLASS="para"> 417Scope</p></th></tr></thead><TBODY CLASS="tbody"> 418<TR CLASS="row" VALIGN="TOP"> 419<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 420<P CLASS="para"> 421<CODE CLASS="literal"> 422encrypt passwords</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 423<P CLASS="para"> 424boolean</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 425<P CLASS="para">Turns on encrypted passwords.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 426<P CLASS="para"> 427<CODE CLASS="literal"> 428no</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 429<P CLASS="para"> 430Global</p></td></tr><TR CLASS="row" VALIGN="TOP"> 431<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 432<P CLASS="para"> 433<CODE CLASS="literal"> 434unix password sync </code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 435<P CLASS="para"> 436boolean</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 437<P CLASS="para"> 438If <CODE CLASS="literal"> 439yes</code>, Samba updates the standard Unix password database when a user changes his or her encrypted password.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 440<P CLASS="para"> 441<CODE CLASS="literal"> 442no</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 443<P CLASS="para"> 444Global</p></td></tr><TR CLASS="row" VALIGN="TOP"> 445<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 446<P CLASS="para"> 447<CODE CLASS="literal"> 448passwd chat</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 449<P CLASS="para"> 450string (chat commands)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 451<P CLASS="para"> 452Sets a sequence of commands that will be sent to the password program.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 453<P CLASS="para"> 454See earlier section on this option</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 455<P CLASS="para"> 456Global</p></td></tr><TR CLASS="row" VALIGN="TOP"> 457<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 458<P CLASS="para"> 459<CODE CLASS="literal"> 460passwd chat debug</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 461<P CLASS="para"> 462boolean</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 463<P CLASS="para"> 464Sends debug logs of the password-change process to the log files with a level of 100.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 465<P CLASS="para"> 466<CODE CLASS="literal"> 467no</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 468<P CLASS="para"> 469Global</p></td></tr><TR CLASS="row" VALIGN="TOP"> 470<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 471<P CLASS="para"> 472<CODE CLASS="literal"> 473passwd program</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 474<P CLASS="para"> 475string (Unix command)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 476<P CLASS="para"> 477Sets the program to be used to change passwords.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 478<P CLASS="para"> 479<CODE CLASS="literal"> 480/bin/passwd %u</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 481<P CLASS="para"> 482Global</p></td></tr><TR CLASS="row" VALIGN="TOP"> 483<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 484<P CLASS="para"> 485<CODE CLASS="literal"> 486password level</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 487<P CLASS="para"> 488numeric</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 489<P CLASS="para"> 490Sets the number of capital letter permutations to attempt when matching a client's password.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 491<P CLASS="para"> 492None</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 493<P CLASS="para"> 494Global</p></td></tr><TR CLASS="row" VALIGN="TOP"> 495<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 496<P CLASS="para"> 497<CODE CLASS="literal"> 498update encrypted</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 499<P CLASS="para"> 500boolean</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 501<P CLASS="para"> 502If <CODE CLASS="literal"> 503yes</code>, Samba updates the encrypted password file when a client connects to a share with a plaintext password.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 504<P CLASS="para"> 505<CODE CLASS="literal"> 506no</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 507<P CLASS="para"> 508Global</p></td></tr><TR CLASS="row" VALIGN="TOP"> 509<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 510<P CLASS="para"> 511<CODE CLASS="literal"> 512null passwords</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 513<P CLASS="para"> 514boolean</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 515<P CLASS="para"> 516If <CODE CLASS="literal"> 517yes</code>, Samba allows access for users with null passwords.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 518<P CLASS="para"> 519<CODE CLASS="literal"> 520no</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 521<P CLASS="para"> 522Global</p></td></tr><TR CLASS="row" VALIGN="TOP"> 523<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 524<P CLASS="para"> 525<CODE CLASS="literal"> 526smb passwd file</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 527<P CLASS="para"> 528string (fully-qualified pathname)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 529<P CLASS="para"> 530Specifies the name of the encrypted password file.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 531<P CLASS="para"> 532<CODE CLASS="literal"> 533/usr/local/samba/private/smbpasswd</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 534<P CLASS="para"> 535Global</p></td></tr><TR CLASS="row" VALIGN="TOP"> 536<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 537<P CLASS="para"> 538<CODE CLASS="literal"> 539hosts equiv</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 540<P CLASS="para"> 541string (fully-qualified pathname)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 542<P CLASS="para"> 543Specifies the name of a file that contains hosts and users that can connect without using a password.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 544<P CLASS="para"> 545None</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 546<P CLASS="para"> 547Global</p></td></tr><TR CLASS="row" VALIGN="TOP"> 548<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 549<P CLASS="para"> 550<CODE CLASS="literal"> 551use rhosts</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 552<P CLASS="para"> 553string (fully-qualified pathname)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 554<P CLASS="para"> 555Specifies the name of an .<EM CLASS="emphasis"> 556rhosts</em> file that allows users to connect without using a password.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 557<P CLASS="para"> 558None</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 559<P CLASS="para"> 560Global</p></td></tr></tbody></table><DIV CLASS="sect3"> 561<H4 CLASS="sect3"> 562<A CLASS="title" NAME="ch06-pgfId-968072"> 5636.4.4.1 unix password sync</a></h4><P CLASS="para"> 564The <CODE CLASS="literal"> 565unix</code> <CODE CLASS="literal"> 566password</code> <CODE CLASS="literal"> 567sync</code> global option allows Samba to update the standard Unix password file when a user changes his or her encrypted password. The encrypted password is stored on a Samba server in the <I CLASS="filename"> 568smbpasswd</i> file, which is located in <I CLASS="filename"> 569/usr/local/samba/private</i> by default. You can activate this feature as follows:</p><PRE CLASS="programlisting"> 570[global] 571 unix password sync = yes</pre><P CLASS="para"> 572If this option is enabled, Samba changes the encrypted password and, in addition, attempts to change the standard Unix password by passing the username and new password to the program specified by the <CODE CLASS="literal"> 573passwd</code> <CODE CLASS="literal"> 574program</code> option (described earlier). Note that Samba does not necessarily have access to the plaintext password for this user, so the password changing program must be invoked as <CODE CLASS="literal"> 575root</code>.[<A CLASS="footnote" HREF="#ch06-pgfId-959675">3</a>] If the Unix password change does not succeed, for whatever reason, the SMB password will not be changed either.</p><BLOCKQUOTE CLASS="footnote"> 576<DIV CLASS="footnote"> 577<P CLASS="para"> 578<A CLASS="footnote" NAME="ch06-pgfId-959675">[3]</a> This is because the Unix <EM CLASS="emphasis"> 579passwd</em> program, which is the usual target for this operation, allows <CODE CLASS="literal"> 580root</code> to change a user's password without the security restriction that requests the old password of that user.</p></div></blockquote></div><DIV CLASS="sect3"> 581<H4 CLASS="sect3"> 582<A CLASS="title" NAME="ch06-pgfId-958684"> 5836.4.4.2 encrypt passwords</a></h4><P CLASS="para">The <CODE CLASS="literal"> 584encrypt</code> <CODE CLASS="literal"> 585passwords</code> global option switches Samba from using plaintext passwords to encrypted passwords for authentication. Encrypted passwords will be expected from clients if the option is set to <CODE CLASS="literal"> 586yes</code>:</p><PRE CLASS="programlisting"> 587encrypt passwords = yes</pre><P CLASS="para"> 588By default, Windows NT 4.0 with Service Pack 3 or above and Windows 98 transmit encrypted passwords over the network. If you are enabling encrypted passwords, you must have a valid <I CLASS="filename"> 589smbpasswd</i> file in place and populated with usernames that will authenticate with encrypted passwords. (See the section <A CLASS="xref" HREF="ch06_04.html#ch06-17782"> 590Section 6.4.2, The smbpasswd File</a>, earlier in this chapter.) In addition, Samba must know the location of the <I CLASS="filename"> 591smbpasswd</i> file; if it is not in the default location (typically <I CLASS="filename"> 592/usr/local/samba/private/smbpasswd</i>), you can explicitly name it using the <CODE CLASS="literal"> 593smb</code> <CODE CLASS="literal"> 594passwd</code> <CODE CLASS="literal"> 595file</code> option.</p><P CLASS="para"> 596If you wish, you can use the <CODE CLASS="literal"> 597update</code> <CODE CLASS="literal"> 598encrypted</code> to force Samba to update the <I CLASS="filename"> 599smbpasswd</i> file with encrypted passwords each time a client connects to a non-encrypted password.</p><P CLASS="para"> 600A common strategy to ensure that hosts who need encrypted password authentication indeed receive it is with the <CODE CLASS="literal"> 601include</code> option. With this, you can create individual configuration files that will be read in based on OS-type (<CODE CLASS="literal">%a</code>) or client name (<CODE CLASS="literal">%m</code>). These host-specific or OS-specific configuration files can contain an <CODE CLASS="literal"> 602encrypted</code> <CODE CLASS="literal"> 603passwords</code> <CODE CLASS="literal"> 604=</code> <CODE CLASS="literal"> 605yes</code> option that will activate only when those clients are connecting to the server.</p></div><DIV CLASS="sect3"> 606<H4 CLASS="sect3"> 607<A CLASS="title" NAME="ch06-pgfId-954367"> 6086.4.4.3 passwd program</a></h4><P CLASS="para"> 609The <CODE CLASS="literal"> 610passwd</code> <CODE CLASS="literal"> 611program</code> is used to specify a program on the Unix Samba server that Samba can use to update the standard system password file when the encrypted password file is updated. This option defaults to the standard<EM CLASS="emphasis"> 612 passwd</em> program, usually located in the <I CLASS="filename"> 613/bin</i> directory. The <CODE CLASS="literal"> 614%u</code> variable is typically used here as the requesting user when the command is executed. The actual handling of input and output to this program during execution is handled through the <CODE CLASS="literal"> 615passwd</code> <CODE CLASS="literal"> 616chat</code> option. The "Password Synchronization" section, earlier in this chapter, covers this option in detail.</p></div><DIV CLASS="sect3"> 617<H4 CLASS="sect3"> 618<A CLASS="title" NAME="ch06-pgfId-954372"> 6196.4.4.4 passwd chat</a></h4><P CLASS="para"> 620This option specifies a series of send/response strings similar to a Unix chat script, which are used to interface with the password-changing program on the Samba server. The "Password Synchronization" section, earlier in this chapter, covers this option in detail.</p></div><DIV CLASS="sect3"> 621<H4 CLASS="sect3"> 622<A CLASS="title" NAME="ch06-pgfId-954442"> 6236.4.4.5 passwd chat debug</a></h4><P CLASS="para"> 624If set to <CODE CLASS="literal"> 625yes</code>, the <CODE CLASS="literal"> 626passwd</code> <CODE CLASS="literal"> 627chat</code> <CODE CLASS="literal"> 628debug</code> global option logs everything sent or received by Samba during a password chat. All the I/O received by Samba through the password chat is sent to the Samba logs with a debug level of 100; you will need to specify <CODE CLASS="literal"> 629log</code> <CODE CLASS="literal"> 630level</code> <CODE CLASS="literal"> 631=</code> <CODE CLASS="literal"> 632100</code> in order for the information to be recorded. The "Password Synchronization" section<EM CLASS="emphasis"> 633,</em> earlier in this chapter, describes this option in more detail. Be aware that if you do set this option, the plaintext passwords will be visible in the debugging logs, which could be a security hazard if they are not properly secured.</p></div><DIV CLASS="sect3"> 634<H4 CLASS="sect3"> 635<A CLASS="title" NAME="ch06-pgfId-958069"> 6366.4.4.6 password level</a></h4><P CLASS="para"> 637With SMB, non-encrypted (or plaintext) passwords are sent with capital letters, just like the usernames mentioned previously. Many Unix users, however, choose passwords with both uppercase and lowercase letters. Samba, by default, only attempts to match the password entirely in lowercase letters, and not capitalizing the first letter.</p><P CLASS="para"> 638Like <CODE CLASS="literal"> 639username</code> <CODE CLASS="literal"> 640level</code>, there is a <CODE CLASS="literal"> 641password</code> <CODE CLASS="literal"> 642level</code> option that can be used to attempt various permutations of the password with capital letters. This option takes an integer value that specifies how many letters in the password should be capitalized when attempting to connect to a share. You can specify this options as follows:</p><PRE CLASS="programlisting"> 643[global] 644 password level = 3</pre><P CLASS="para"> 645In this case, Samba will then attempt all permutations of the password it can compute having three capital letters. The larger the number, the more computations Samba will have to perform to match the password, and the longer a connection to a specific share may take. </p></div><DIV CLASS="sect3"> 646<H4 CLASS="sect3"> 647<A CLASS="title" NAME="ch06-pgfId-954452"> 6486.4.4.7 update encrypted</a></h4><P CLASS="para"> 649For sites switching over to the encrypted password format, Samba provides an option that should help with the transition. The <CODE CLASS="literal"> 650update</code> <CODE CLASS="literal"> 651encrypted</code> option allows a site to ease into using encrypted passwords from plaintext passwords. You can activate this option as follows:</p><PRE CLASS="programlisting"> 652[global] 653 update encrypted = yes</pre><P CLASS="para"> 654This instructs Samba to create an encrypted version of each user's Unix password in the <I CLASS="filename"> 655smbpasswd</i> file each time he or she connects to a share. When this option is enabled, you must have the <CODE CLASS="literal"> 656encrypt</code> <CODE CLASS="literal"> 657passwords</code> option set to <CODE CLASS="literal"> 658no</code> so that the client will pass plaintext passwords to Samba to use to update the files. Once each user has connected at least once, you can set <CODE CLASS="literal"> 659encrypted</code> <CODE CLASS="literal"> 660passwords</code> <CODE CLASS="literal"> 661=</code> <CODE CLASS="literal"> 662yes</code>, allowing you to use only the encrypted passwords. The user must already have a valid entry in the <I CLASS="filename"> 663smbpasswd</i> file for this option to work.</p></div><DIV CLASS="sect3"> 664<H4 CLASS="sect3"> 665<A CLASS="title" NAME="ch06-pgfId-958716"> 6666.4.4.8 null passwords</a></h4><P CLASS="para"> 667This global option tells Samba whether or not to allow access from users that have null passwords (encrypted or non-encrypted) set in their accounts. The default value is <CODE CLASS="literal"> 668no</code>. You can override it as follows:</p><PRE CLASS="programlisting"> 669null passwords = yes</pre><P CLASS="para"> 670We highly recommend against doing so unless you are familiar with the security risks this option can present to your system, including inadvertent access to system users (such as <I CLASS="filename"> 671bin</i>) in the system password file who have null passwords set.</p></div><DIV CLASS="sect3"> 672<H4 CLASS="sect3"> 673<A CLASS="title" NAME="ch06-pgfId-959357"> 6746.4.4.9 smb passwd file</a></h4><P CLASS="para">This global option identifies the location of the encrypted password database. By default, it is set to <I CLASS="filename"> 675/usr/local/samba/private/smbpasswd</i>. You can override it as follows:</p><PRE CLASS="programlisting"> 676[global] 677 smb passwd file = /etc/smbpasswd</pre><P CLASS="para"> 678This location, for example, is common on many Red Hat distributions.</p></div><DIV CLASS="sect3"> 679<H4 CLASS="sect3"> 680<A CLASS="title" NAME="ch06-pgfId-969088"> 6816.4.4.10 hosts equiv</a></h4><P CLASS="para"> 682This global option specifies the name of a standard Unix <I CLASS="filename"> 683hosts.equiv</i> file that will allow hosts or users to access shares without specifying a password. You can specify the location of such a file as follows:</p><PRE CLASS="programlisting"> 684[global] 685 hosts equiv = /etc/hosts.equiv</pre><P CLASS="para"> 686The default value for this option does not specify any <I CLASS="filename"> 687hosts.equiv</i> file. Because using such a file is essentially a huge security risk, we highly recommend that you do not use this option unless you are confident in the security of your network.</p></div><DIV CLASS="sect3"> 688<H4 CLASS="sect3"> 689<A CLASS="title" NAME="ch06-pgfId-959358"> 6906.4.4.11 use rhosts</a></h4><P CLASS="para"> 691This global option specifies the name of a standard Unix user's <I CLASS="filename"> 692.rhosts</i> file that will allow foreign hosts to access shares without specifying a password. You can specify the location of such a file as follows:</p><PRE CLASS="programlisting"> 693[global] 694 use rhosts = /home/dave/.rhosts</pre><P CLASS="para"> 695The default value for this option does not specify any <I CLASS="filename"> 696.rhosts</i> file. Like the <CODE CLASS="literal"> 697hosts</code> <CODE CLASS="literal"> 698equiv</code> option above, using such a file is a security risk. We highly recommend that you do use this option unless you are confident in the security of your network. </p></div></div></div></blockquote> 699<div> 700<center> 701<hr noshade size=1><TABLE WIDTH="515" BORDER="0" CELLSPACING="0" CELLPADDING="0"> 702<TR> 703<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172"> 704<A CLASS="sect1" HREF="ch06_03.html" TITLE="6.3 Authentication Security"> 705<IMG SRC="gifs/txtpreva.gif" ALT="Previous: 6.3 Authentication Security" BORDER="0"></a></td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171"> 706<A CLASS="book" HREF="index.html" TITLE=""> 707<IMG SRC="gifs/txthome.gif" ALT="" BORDER="0"></a></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172"> 708<A CLASS="sect1" HREF="ch06_05.html" TITLE="6.5 Windows Domains"> 709<IMG SRC="gifs/txtnexta.gif" ALT="Next: 6.5 Windows Domains" BORDER="0"></a></td></tr><TR> 710<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172"> 7116.3 Authentication Security</td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171"> 712<A CLASS="index" HREF="inx.html" TITLE="Book Index"> 713<IMG SRC="gifs/index.gif" ALT="Book Index" BORDER="0"></a></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172"> 7146.5 Windows Domains</td></tr></table><hr noshade size=1></center> 715</div> 716 717<!-- End of sample chapter --> 718<CENTER> 719<FONT SIZE="1" FACE="Verdana, Arial, Helvetica"> 720<A HREF="http://www.oreilly.com/"> 721<B>O'Reilly Home</B></A> <B> | </B> 722<A HREF="http://www.oreilly.com/sales/bookstores"> 723<B>O'Reilly Bookstores</B></A> <B> | </B> 724<A HREF="http://www.oreilly.com/order_new/"> 725<B>How to Order</B></A> <B> | </B> 726<A HREF="http://www.oreilly.com/oreilly/contact.html"> 727<B>O'Reilly Contacts<BR></B></A> 728<A HREF="http://www.oreilly.com/international/"> 729<B>International</B></A> <B> | </B> 730<A HREF="http://www.oreilly.com/oreilly/about.html"> 731<B>About O'Reilly</B></A> <B> | </B> 732<A HREF="http://www.oreilly.com/affiliates.html"> 733<B>Affiliated Companies</B></A><p> 734<EM>© 1999, O'Reilly & Associates, Inc.</EM> 735</FONT> 736</CENTER> 737</BODY> 738</html> 739