1<HTML> 2<HEAD> 3<TITLE> 4[Chapter 6] 6.2 Controlling Access to Shares</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:37Z"><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_01.html" TITLE="6.1 Users and Groups"> 35<IMG SRC="gifs/txtpreva.gif" ALT="Previous: 6.1 Users and Groups" 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_03.html" TITLE="6.3 Authentication Security"> 42<IMG SRC="gifs/txtnexta.gif" ALT="Next: 6.3 Authentication Security" 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-27678"> 486.2 Controlling Access to Shares</a></h2><P CLASS="para">Often you will need to restrict the users who can access a specific share for security reasons. This is very easy to do with Samba since it contains a wealth of options for creating practically any security configuration. Let's introduce a few configurations that you might want to use in your own Samba setup.</p><BLOCKQUOTE CLASS="warning"> 49<P CLASS="para"> 50<STRONG> 51WARNING:</strong> Again, if you are connecting with Windows 98 or NT 4.0 with Service Pack 3 (or above), those clients will send encrypted passwords to the Samba server. If Samba is not configured for this, it will continually refuse the connection. This chapter describes how to set up Samba for encrypted passwords. See the <A CLASS="xref" HREF="ch06_04.html"> 52Section 6.4, Passwords</a> section.</p></blockquote><P CLASS="para"> 53We've seen what happens when you specify valid users. However, you are also allowed to specify a list of invalid users - users who should never be allowed access to Samba or its shares. This is done with the <CODE CLASS="literal"> 54invalid</code> <CODE CLASS="literal"> 55users</code> option. We hinted at one frequent use of this option earlier: a global default with the <CODE CLASS="literal"> 56[homes]</code> section to ensure that various system users and superusers cannot be forged for access. For example:</p><PRE CLASS="programlisting"> 57[global] 58 invalid users = root bin daemon adm sync shutdown \ 59 halt mail news uucp operator gopher 60 auto services = dave peter bob 61 62[homes] 63 browsable = no 64 writeable = yes</pre><P CLASS="para"> 65The <CODE CLASS="literal"> 66invalid</code> <CODE CLASS="literal"> 67users</code> option, like <CODE CLASS="literal"> 68valid</code> <CODE CLASS="literal"> 69users</code>, can take group names as well as usernames. In the event that a user or group appears in both lists, the <CODE CLASS="literal"> 70invalid</code> <CODE CLASS="literal"> 71users</code> option takes precedence and the user or group will be denied access to the share.</p><P CLASS="para"> 72At the other end of the spectrum, you can explicitly specify users who will be allowed superuser (root) access to a share with the <CODE CLASS="literal"> 73admin</code> <CODE CLASS="literal"> 74users</code> option. An example follows:</p><PRE CLASS="programlisting"> 75[sales] 76 path = /home/sales 77 comment = Fiction Corp Sales Data 78 writeable = yes 79 valid users = tom dick harry 80 admin users = mike</pre><P CLASS="para"> 81This option takes both group names and usernames. In addition, you can specify NIS netgroups by preceding them with an <CODE CLASS="literal"> 82@</code> as well; if the netgroup is not found, Samba will assume that you are referring to a standard Unix group. </p><P CLASS="para"> 83Be careful if you assign an entire group administrative privileges to a share. The Samba team highly recommends you avoid using this option, as it essentially gives root access to the specified users or groups for that share.</p><P CLASS="para"> 84If you wish to force read-only or read-write access to users who access a share, you can do so with the <CODE CLASS="literal"> 85read</code> <CODE CLASS="literal"> 86list</code> and <CODE CLASS="literal"> 87write</code> <CODE CLASS="literal"> 88list</code> options, respectively. These options can be used on a per-share basis to restrict a writable share or grant write access to specific users in a read-only share, respectively. For example:</p><PRE CLASS="programlisting"> 89[sales] 90 path = /home/sales 91 comment = Fiction Corp Sales Data 92 read only = yes 93 write list = tom dick</pre><P CLASS="para"> 94The <CODE CLASS="literal"> 95write</code> <CODE CLASS="literal"> 96list</code> option cannot override Unix permissions. If you've created the share without giving the write-list user write permission on the Unix system, he or she will be denied write access regardless of the setting of <CODE CLASS="literal"> 97write</code> <CODE CLASS="literal"> 98list</code>.</p><DIV CLASS="sect2"> 99<H3 CLASS="sect2"> 100<A CLASS="title" NAME="ch06-pgfId-968870"> 1016.2.1 Guest Access</a></h3><P CLASS="para">As mentioned earlier, you can specify users who have guest access to a share. The options that control guest access are easy to work with. The first option, <CODE CLASS="literal"> 102guest</code> <CODE CLASS="literal"> 103account</code>, specifies the Unix account that guest users should be assigned when connecting to the Samba server. The default value for this is set during compilation, and is typically <CODE CLASS="literal"> 104nobody</code>. However, you may want to reset the guest user to <CODE CLASS="literal"> 105ftp</code> if you have trouble accessing various system services. </p><P CLASS="para"> 106If you wish to restrict access in a share only to guests - in other words, all clients connect as the guest account when accessing the share - you can use the <CODE CLASS="literal"> 107guest</code> <CODE CLASS="literal"> 108only</code> option in conjunction with the <CODE CLASS="literal"> 109guest ok</code> option, as shown in the following example:</p><PRE CLASS="programlisting"> 110[sales] 111 path = /home/sales 112 comment = Fiction Corp Sales Data 113 writeable = yes 114 guest ok = yes 115 guest account = ftp 116 guest only = yes</pre><P CLASS="para"> 117Make sure you specify <CODE CLASS="literal"> 118yes</code> for both <CODE CLASS="literal"> 119guest only</code> and <CODE CLASS="literal"> 120guest ok</code> in this scenario; otherwise, Samba will not use the guest acount that you specify.</p></div><DIV CLASS="sect2"> 121<H3 CLASS="sect2"> 122<A CLASS="title" NAME="ch06-pgfId-960007"> 1236.2.2 Access Control Options</a></h3><P CLASS="para"> 124<A CLASS="xref" HREF="ch06_02.html#ch06-28077">Table 6.1</a> summarizes the options that you can use to control access to shares. </p><br> 125<TABLE CLASS="table" BORDER="1" CELLPADDING="3"> 126<CAPTION CLASS="table"> 127<A CLASS="title" NAME="ch06-28077"> 128Table 6.1: Share-level Access Options </a></caption><THEAD CLASS="thead"> 129<TR CLASS="row" VALIGN="TOP"> 130<TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 131<P CLASS="para"> 132Option</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 133<P CLASS="para"> 134Parameters</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 135<P CLASS="para"> 136Function</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 137<P CLASS="para"> 138Default</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 139<P CLASS="para"> 140Scope</p></th></tr></thead><TBODY CLASS="tbody"> 141<TR CLASS="row" VALIGN="TOP"> 142<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 143<P CLASS="para"> 144<CODE CLASS="literal"> 145admin users</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 146<P CLASS="para"> 147string (list of usernames)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 148<P CLASS="para"> 149Specifies a list of users who can perform operations as root.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 150<P CLASS="para"> 151None</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 152<P CLASS="para"> 153Share</p></td></tr><TR CLASS="row" VALIGN="TOP"> 154<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 155<P CLASS="para"> 156<CODE CLASS="literal"> 157valid users</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 158<P CLASS="para"> 159string (list of usernames)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 160<P CLASS="para"> 161Specifies a list of users that can connect to a share.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 162<P CLASS="para"> 163None</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 164<P CLASS="para"> 165Share</p></td></tr><TR CLASS="row" VALIGN="TOP"> 166<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 167<P CLASS="para"> 168<CODE CLASS="literal"> 169invalid users</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 170<P CLASS="para"> 171string (list of usernames)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 172<P CLASS="para"> 173Specifies a list of users that will be denied access to a share.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 174<P CLASS="para"> 175None</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 176<P CLASS="para"> 177Share</p></td></tr><TR CLASS="row" VALIGN="TOP"> 178<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 179<P CLASS="para"> 180<CODE CLASS="literal"> 181read list</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 182<P CLASS="para"> 183string (list of usernames)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 184<P CLASS="para"> 185Specifies a list of users that have read-only access to a writable share.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 186<P CLASS="para"> 187None</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 188<P CLASS="para"> 189Share</p></td></tr><TR CLASS="row" VALIGN="TOP"> 190<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 191<P CLASS="para"> 192<CODE CLASS="literal"> 193write list</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 194<P CLASS="para"> 195string (list of usernames)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 196<P CLASS="para"> 197Specifies a list of users that have read-write access to a read-only share.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 198<P CLASS="para"> 199None</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 200<P CLASS="para"> 201Share</p></td></tr><TR CLASS="row" VALIGN="TOP"> 202<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 203<P CLASS="para"> 204<CODE CLASS="literal"> 205max connections</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 206<P CLASS="para"> 207numerical</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 208<P CLASS="para"> 209Indicates the maximum number of connections for a share at a given time.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 210<P CLASS="para"> 211<CODE CLASS="literal"> 2120</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 213<P CLASS="para"> 214Share</p></td></tr><TR CLASS="row" VALIGN="TOP"> 215<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 216<P CLASS="para"> 217<CODE CLASS="literal"> 218guest only (only guest)</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 219<P CLASS="para"> 220boolean</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 221<P CLASS="para"> 222Specifies that this share allows only guest access.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 223<P CLASS="para"> 224<CODE CLASS="literal"> 225no</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 226<P CLASS="para"> 227Share</p></td></tr><TR CLASS="row" VALIGN="TOP"> 228<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 229<P CLASS="para"> 230<CODE CLASS="literal"> 231guest account</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 232<P CLASS="para"> 233string (name of account)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 234<P CLASS="para"> 235Names the Unix account that will be used for guest access.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 236<P CLASS="para"> 237<CODE CLASS="literal"> 238nobody</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 239<P CLASS="para"> 240Share</p></td></tr></tbody></table><DIV CLASS="sect3"> 241<H4 CLASS="sect3"> 242<A CLASS="title" NAME="ch06-pgfId-959222"> 2436.2.2.1 admin users</a></h4><P CLASS="para"> 244This option specifies a list of users that perform file operations as if they were <CODE CLASS="literal"> 245root</code>. This means that they can modify or destroy any other user's work, no matter what the permissions. Any files that they create will have root ownership and will use the default group of the admin user. The <CODE CLASS="literal"> 246admin</code> <CODE CLASS="literal"> 247users</code> option is used to allow PC users to act as administrators for particular shares. We urge you to avoid this option. </p></div><DIV CLASS="sect3"> 248<H4 CLASS="sect3"> 249<A CLASS="title" NAME="ch06-pgfId-960368"> 2506.2.2.2 valid users and invalid users</a></h4><P CLASS="para"> 251These two options let you enumerate the users and groups who are granted or denied access to a particular share. You can enter a list of comma-delimited users, or indicate an NIS or Unix group name by prefixing the name with an at-sign (<CODE CLASS="literal">@</code>). </p><P CLASS="para"> 252The important rule to remember with these options is that any name or group in the <CODE CLASS="literal"> 253invalid</code> <CODE CLASS="literal"> 254users</code> list will <EM CLASS="emphasis"> 255always</em> be denied access, even if it is included (in any form) in the <CODE CLASS="literal"> 256valid</code> <CODE CLASS="literal"> 257users</code> list. By default, neither option has a value associated with it. If both options have no value, any user is allowed to access the share.</p></div><DIV CLASS="sect3"> 258<H4 CLASS="sect3"> 259<A CLASS="title" NAME="ch06-pgfId-959243"> 2606.2.2.3 read list and write list</a></h4><P CLASS="para"> 261Like the <CODE CLASS="literal"> 262valid</code> <CODE CLASS="literal"> 263users</code> <CODE CLASS="literal"> 264and</code> <CODE CLASS="literal"> 265invalid</code> <CODE CLASS="literal"> 266users</code> options, this pair of options specifies which users have read-only access to a writeable share and read-write access to a read-only share, respectively. The value of either options is a list of users. <CODE CLASS="literal"> 267read</code> <CODE CLASS="literal"> 268list</code> overrides any other Samba permissions granted - as well as Unix file permissions on the server system - to deny users write access. <CODE CLASS="literal"> 269write</code> <CODE CLASS="literal"> 270list</code> overrides other Samba permissions to grant write access, but cannot grant write access if the user lacks write permissions for the file on the Unix system. You can specify NIS or Unix group names by prefixing the name with an at sign (such as <CODE CLASS="literal"> 271@users</code>). Neither configuration option has a default value associated with it.</p></div><DIV CLASS="sect3"> 272<H4 CLASS="sect3"> 273<A CLASS="title" NAME="ch06-pgfId-959253"> 2746.2.2.4 max connections</a></h4><P CLASS="para"> 275This option specifies the maximum number of client connections that a share can have at any given time. Any connections that are attempted after the maximum is reached will be rejected. The default value is <CODE CLASS="literal"> 2760</code>, which means that an unlimited number of connections are allowed. You can override it per share as follows:</p><PRE CLASS="programlisting"> 277[accounting] 278 max connections = 30</pre><P CLASS="para"> 279This option is useful in the event that you need to limit the number of users who are accessing a licensed program or piece of data concurrently.</p></div><DIV CLASS="sect3"> 280<H4 CLASS="sect3"> 281<A CLASS="title" NAME="ch06-pgfId-958842"> 2826.2.2.5 guest only</a></h4><P CLASS="para"> 283This share-level option (sometimes called <CODE CLASS="literal"> 284only</code> <CODE CLASS="literal"> 285guest</code>) forces a connection to a share to be performed with the user specified by the <CODE CLASS="literal"> 286guest</code> <CODE CLASS="literal"> 287account</code> option. The share to which this is applied must explicitly specify <CODE CLASS="literal"> 288guest</code> <CODE CLASS="literal"> 289ok</code> <CODE CLASS="literal"> 290=</code> <CODE CLASS="literal"> 291yes</code> in order for this option to be recognized by Samba. The default value for this option is <CODE CLASS="literal"> 292no</code>. </p></div><DIV CLASS="sect3"> 293<H4 CLASS="sect3"> 294<A CLASS="title" NAME="ch06-pgfId-960637"> 2956.2.2.6 guest account</a></h4><P CLASS="para"> 296This option specifies the name of account to be used for guest access to shares in Samba. The default for this option varies from system to system, but it is often set to <CODE CLASS="literal"> 297nobody</code>. Some default user accounts have trouble connecting as guest users. If that occurs on your system, the Samba team recommends using the ftp account as the guest user. </p></div></div><DIV CLASS="sect2"> 298<H3 CLASS="sect2"> 299<A CLASS="title" NAME="ch06-pgfId-959934"> 3006.2.3 Username Options</a></h3><P CLASS="para"> 301<A CLASS="xref" HREF="ch06_02.html#ch06-82964">Table 6.2</a> shows two additional options that Samba can use to correct for incompatibilities in usernames between Windows and Unix. </p><br> 302<TABLE CLASS="table" BORDER="1" CELLPADDING="3"> 303<CAPTION CLASS="table"> 304<A CLASS="title" NAME="ch06-82964"> 305Table 6.2: Username Options </a></caption><THEAD CLASS="thead"> 306<TR CLASS="row" VALIGN="TOP"> 307<TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 308<P CLASS="para"> 309Option</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 310<P CLASS="para"> 311Parameters</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 312<P CLASS="para"> 313Function</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 314<P CLASS="para"> 315Default</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 316<P CLASS="para"> 317Scope</p></th></tr></thead><TBODY CLASS="tbody"> 318<TR CLASS="row" VALIGN="TOP"> 319<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 320<P CLASS="para"> 321<CODE CLASS="literal"> 322username map</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 323<P CLASS="para"> 324string (fully-qualified pathname)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 325<P CLASS="para"> 326Sets the name of the username mapping file.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 327<P CLASS="para"> 328None</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 329<P CLASS="para"> 330Global</p></td></tr><TR CLASS="row" VALIGN="TOP"> 331<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 332<P CLASS="para"> 333<CODE CLASS="literal"> 334username level</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 335<P CLASS="para"> 336numerical</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 337<P CLASS="para"> 338Indicates the number of capital letters to use when trying to match a username.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 339<P CLASS="para"> 340<CODE CLASS="literal"> 3410</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 342<P CLASS="para"> 343Global</p></td></tr></tbody></table><DIV CLASS="sect3"> 344<H4 CLASS="sect3"> 345<A CLASS="title" NAME="ch06-pgfId-959982"> 3466.2.3.1 username map</a></h4><P CLASS="para">Client usernames on an SMB network can be relatively large (up to 255 characters), while usernames on a Unix network often cannot be larger than eight characters. This means that an individual user may have one username on a client and another (shorter) one on the Samba server. You can get past this issue by<I CLASS="firstterm"> 347 mapping</i> a free-form client username to a Unix username of eight or fewer characters. It is placed in a standard text file, using a format that we'll describe shortly. You can then specify the pathname to Samba with the global <CODE CLASS="literal"> 348username</code> <CODE CLASS="literal"> 349map</code> option. Be sure to restrict access to this file; make the root user the file's owner and deny write access to others. Otherwise, an untrusted user who can access the file can easily map their client username to the root user of the Samba server.</p><P CLASS="para"> 350You can specify this option as follows:</p><PRE CLASS="programlisting"> 351[global] 352 username map = /etc/samba/usermap.txt</pre><P CLASS="para"> 353Each of the entries in the username map file should be listed as follows: the Unix username, followed by an equal sign (<CODE CLASS="literal">=</code>), followed by one or more whitespace-separated SMB client usernames. Note that unless instructed otherwise, (i.e., a guest connection), Samba will expect both the client and the server user to have the same password. You can also map NT groups to one or more specific Unix groups using the <CODE CLASS="literal"> 354@</code> sign. Here are some examples:</p><PRE CLASS="programlisting"> 355jarwin = JosephArwin 356manderso = MarkAnderson 357users = @account</pre><P CLASS="para"> 358Also, you can use the asterisk to specify a wildcard that matches any free-form client username as an entry in the username map file:</p><PRE CLASS="programlisting"> 359nobody = *</pre><P CLASS="para"> 360Comments in the file can be specified as lines beginning with (<CODE CLASS="literal">#</code>) and (<CODE CLASS="literal">;</code>).</p><P CLASS="para"> 361Note that you can also use this file to redirect one Unix user to another user. Be careful if you do so because Samba and your client may not notify the user that the mapping has been made and Samba may be expecting a different password. </p></div><DIV CLASS="sect3"> 362<H4 CLASS="sect3"> 363<A CLASS="title" NAME="ch06-pgfId-959994"> 3646.2.3.2 username level</a></h4><P CLASS="para">SMB clients (such as Windows) will often send usernames in SMB connection requests entirely in capital letters; in other words, client usernames are not necessarily case sensitive. On a Unix server, however, usernames <EM CLASS="emphasis"> 365are</em> case sensitive: the user <CODE CLASS="literal"> 366ANDY</code> is different from the user <CODE CLASS="literal"> 367andy</code>. By default, Samba attacks this problem by doing the following:</p><OL CLASS="orderedlist"> 368<LI CLASS="listitem"> 369<P CLASS="para"> 370<A CLASS="listitem" NAME="ch06-pgfId-959996"> 371</a>Checking for a user account with the exact name sent by the client</p></li><LI CLASS="listitem"> 372<P CLASS="para"> 373<A CLASS="listitem" NAME="ch06-pgfId-969146"> 374</a>Testing the username in all lowercase letters</p></li><LI CLASS="listitem"> 375<P CLASS="para"> 376<A CLASS="listitem" NAME="ch06-pgfId-969147"> 377</a>Testing the username in lowercase letters with only the first letter capitalized</p></li></ol><P CLASS="para"> 378If you wish to have Samba attempt more combinations of uppercase and lowercase letters, you can use the <CODE CLASS="literal"> 379username</code> <CODE CLASS="literal"> 380level</code> global configuration option. This option takes an integer value that specifies how many letters in the username should be capitalized when attempting to connect to a share. You can specify this options as follows:</p><PRE CLASS="programlisting"> 381[global] 382 username level = 3</pre><P CLASS="para"> 383In this case, Samba will then attempt all permutations of usernames it can compute having three capital letters. The larger the number, the more computations Samba will have to perform to match the username and the longer the authentication will take. </p></div></div></div></blockquote> 384<div> 385<center> 386<hr noshade size=1><TABLE WIDTH="515" BORDER="0" CELLSPACING="0" CELLPADDING="0"> 387<TR> 388<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172"> 389<A CLASS="sect1" HREF="ch06_01.html" TITLE="6.1 Users and Groups"> 390<IMG SRC="gifs/txtpreva.gif" ALT="Previous: 6.1 Users and Groups" BORDER="0"></a></td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171"> 391<A CLASS="book" HREF="index.html" TITLE=""> 392<IMG SRC="gifs/txthome.gif" ALT="" BORDER="0"></a></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172"> 393<A CLASS="sect1" HREF="ch06_03.html" TITLE="6.3 Authentication Security"> 394<IMG SRC="gifs/txtnexta.gif" ALT="Next: 6.3 Authentication Security" BORDER="0"></a></td></tr><TR> 395<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172"> 3966.1 Users and Groups</td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171"> 397<A CLASS="index" HREF="inx.html" TITLE="Book Index"> 398<IMG SRC="gifs/index.gif" ALT="Book Index" BORDER="0"></a></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172"> 3996.3 Authentication Security</td></tr></table><hr noshade size=1></center> 400</div> 401 402<!-- End of sample chapter --> 403<CENTER> 404<FONT SIZE="1" FACE="Verdana, Arial, Helvetica"> 405<A HREF="http://www.oreilly.com/"> 406<B>O'Reilly Home</B></A> <B> | </B> 407<A HREF="http://www.oreilly.com/sales/bookstores"> 408<B>O'Reilly Bookstores</B></A> <B> | </B> 409<A HREF="http://www.oreilly.com/order_new/"> 410<B>How to Order</B></A> <B> | </B> 411<A HREF="http://www.oreilly.com/oreilly/contact.html"> 412<B>O'Reilly Contacts<BR></B></A> 413<A HREF="http://www.oreilly.com/international/"> 414<B>International</B></A> <B> | </B> 415<A HREF="http://www.oreilly.com/oreilly/about.html"> 416<B>About O'Reilly</B></A> <B> | </B> 417<A HREF="http://www.oreilly.com/affiliates.html"> 418<B>Affiliated Companies</B></A><p> 419<EM>© 1999, O'Reilly & Associates, Inc.</EM> 420</FONT> 421</CENTER> 422</BODY> 423</html> 424