1<HTML> 2<HEAD> 3<TITLE> 4[Chapter 4] Disk 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:31:52Z"><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="ch03_03.html" TITLE="3.3 An Introduction to SMB/CIFS"> 35<IMG SRC="gifs/txtpreva.gif" ALT="Previous: 3.3 An Introduction to SMB/CIFS" BORDER="0"></a></td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171"> 36<B> 37<FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1"> 38Chapter 4</font></b></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172"> 39<A CLASS="sect1" HREF="ch04_02.html" TITLE="4.2 Special Sections"> 40<IMG SRC="gifs/txtnexta.gif" ALT="Next: 4.2 Special Sections" BORDER="0"></a></td></tr></table> <hr noshade size=1></center> 41</div> 42<blockquote> 43<div class="samplechapter"> 44<H1 CLASS="chapter"> 45<A CLASS="title" NAME="ch04-21486"> 464. Disk Shares </a></h1><DIV CLASS="htmltoc"> 47<P> 48<B> 49Contents:</b><br> 50<A CLASS="sect1" HREF="#ch04-76968" TITLE="4.1 Learning the Samba Configuration File"> 51Learning the Samba Configuration File</a><br> 52<A CLASS="sect1" HREF="ch04_02.html" TITLE="4.2 Special Sections"> 53Special Sections</a><br> 54<A CLASS="sect1" HREF="ch04_03.html" TITLE="4.3 Configuration File Options"> 55Configuration File Options</a><br> 56<A CLASS="sect1" HREF="ch04_04.html" TITLE="4.4 Server Configuration"> 57Server Configuration</a><br> 58<A CLASS="sect1" HREF="ch04_05.html" TITLE="4.5 Disk Share Configuration"> 59Disk Share Configuration</a><br> 60<A CLASS="sect1" HREF="ch04_06.html" TITLE="4.6 Networking Options with Samba"> 61Networking Options with Samba</a><br> 62<A CLASS="sect1" HREF="ch04_07.html" TITLE="4.7 Virtual Servers"> 63Virtual Servers</a><br> 64<A CLASS="sect1" HREF="ch04_08.html" TITLE="4.8 Logging Configuration Options"> 65Logging Configuration Options</a></p><P> 66</p></div><P CLASS="para">In the previous three chapters, we showed you how to install Samba on a Unix server and set up Windows clients to use a simple disk share. This chapter will show you how Samba can assume more productive roles on your network.</p><P CLASS="para"> 67Samba's daemons, <EM CLASS="emphasis"> 68smbd</em> and <EM CLASS="emphasis"> 69nmbd</em>, are controlled through a single ASCII file, <I CLASS="filename"> 70smb.conf</i>, that can contain over 200 unique options. These options define how Samba reacts to the network around it, including everything from simple permissions to encrypted connections and NT domains. The next five chapters are designed to help you get familiar with this file and its options. Some of these options you will use and change frequently; others you may never use - it all depends on how much functionality you want Samba to offer its clients.</p><P CLASS="para"> 71This chapter introduces the structure of the Samba configuration file and shows you how to use these options to create and modify disk shares. Subsequent chapters will discuss browsing, how to configure users, security, domains, and printers, and a host of other myriad topics that you can implement with Samba on your network.</p><DIV CLASS="sect1"> 72<H2 CLASS="sect1"> 73<A CLASS="title" NAME="s1"></a> 74<A CLASS="title" NAME="ch04-76968"> 754.1 Learning the Samba Configuration File</a></h2><P CLASS="para"> 76<I CLASS="filename"> 77</i>Here is an <I CLASS="filename"> 78</i>example of a Samba configuration file. If you have worked with a Windows .INI file, the structure of the <I CLASS="filename"> 79smb.conf </i> file should look very familiar: </p><PRE CLASS="programlisting"> 80[global] 81 log level = 1 82 max log size = 1000 83 socket options = TCP_NODELAY IPTOS_LOWDELAY 84 guest ok = no 85[homes] 86 browseable = no 87 map archive = yes 88[printers] 89 path = /usr/tmp 90 guest ok = yes 91 printable = yes 92 min print space = 2000 93[test] 94 browseable = yes 95 read only = yes 96 guest ok = yes 97 path = /export/samba/test</pre><P CLASS="para"> 98Although you may not understand the contents yet, this is a good configuration file to grab if you're in a hurry. (If you're not, we'll create a new one from scratch shortly.) In a nutshell, this configuration file sets up basic debug logging in a default log file not to exceed 1MB, optimizes TCP/IP socket connections between the Samba server and any SMB clients, and allows Samba to create a disk share for each user that has a standard Unix account on the server. In addition, each of the printers registered on the server will be publicly available, as will a single read-only share that maps to the <I CLASS="filename"> 99/export/samba/test</i> directory. The last part of this file is similar to the disk share you used to test Samba in <a href="ch02_01.html"><b>Chapter 2, <CITE CLASS="chapter">Installing Samba on a Unix System</cite></b></a>.</p><DIV CLASS="sect2"> 100<H3 CLASS="sect2"> 101<A CLASS="title" NAME="ch04-52415"> 1024.1.1 Configuration File Structure</a></h3><P CLASS="para"> 103<I CLASS="filename"> 104</i>Let's take another look at this configuration file, this time from a higher level:</p><PRE CLASS="programlisting"> 105[global] 106 ... 107[homes] 108 ... 109[printers] 110 ... 111[test] 112 ...</pre><P CLASS="para"> 113The names inside the square brackets delineate unique sections of the <I CLASS="filename"> 114smb.conf</i> file; each section names the <I CLASS="firstterm"> 115share</i> (or service) that the section refers to. For example, the <CODE CLASS="literal"> 116[test]</code> and <CODE CLASS="literal"> 117[homes]</code> sections are each unique disk shares; they contain options that map to specific directories on the Samba server. The <CODE CLASS="literal"> 118[printers]</code> share contains options that map to various printers on the server. All the sections defined in the <I CLASS="filename"> 119smb.conf</i> file, with the exception of the <CODE CLASS="literal"> 120[global]</code> section, will be available as a disk or printer share to clients connecting to the Samba server.</p><P CLASS="para"> 121The remaining lines are individual configuration options unique to that share. These options will continue until a new bracketed section is encountered, or until the end of the file is reached. Each configuration option follows a simple format:</p><PRE CLASS="programlisting"><CODE CLASS="replaceable"><I>option</i></code> = <CODE CLASS="replaceable"><I>value</i></code></pre><P CLASS="para"> 122Options in the <I CLASS="filename"> 123smb.conf</i> file are set by assigning a value to them. We should warn you up front that some of the option names in Samba are poorly chosen. For example, <CODE CLASS="literal"> 124read</code> <CODE CLASS="literal"> 125only</code> is self-explanatory, and is typical of many recent Samba options. <CODE CLASS="literal"> 126public</code> is an older option, and is vague; it now has a less-confusing synonym <CODE CLASS="literal"> 127guest</code> <CODE CLASS="literal"> 128ok</code> (may be accessed by guests). We describe some of the more common historical names in this chapter in sections that highlight each major task. In addition, <a href="appc_01.html"><b>Appendix C, <CITE CLASS="appendix">Samba Configuration Option Quick Reference</cite></b></a>, contains an alphabetical index of all the configuration options and their meanings.</p><DIV CLASS="sect3"> 129<H4 CLASS="sect3"> 130<A CLASS="title" NAME="ch04-pgfId-955562"> 1314.1.1.1 Whitespaces, quotes, and commas</a></h4><P CLASS="para"> 132An important item to remember about configuration options is that all whitespaces in the <CODE CLASS="replaceable"> 133<I> 134value</i></code> are significant. For example, consider the following option:</p><PRE CLASS="programlisting"> 135volume = The Big Bad Hard Drive Number 3543</pre><P CLASS="para"> 136Samba strips away the spaces between the final <CODE CLASS="literal"> 137e</code> in <CODE CLASS="literal"> 138volume</code> and the first <CODE CLASS="literal"> 139T</code> in <CODE CLASS="literal"> 140The</code>. These whitespaces are insignificant. The rest of the whitespaces are significant and will be recognized and preserved by Samba when reading in the file. Space is not significant in option names (such as <CODE CLASS="literal"> 141guest</code> <CODE CLASS="literal"> 142ok</code>), but we recommend you follow convention and keep spaces between the words of options.</p><P CLASS="para"> 143If you feel safer including quotation marks at the beginning and ending of a configuration option's value, you may do so. Samba will ignore these quotation marks when it encounters them. Never use quotation marks around an option itself; Samba will treat this as an error.</p><P CLASS="para"> 144Finally, you can use whitespaces to separate a series of values in a list, or you can use commas. These two options are equivalent:</p><PRE CLASS="programlisting"> 145netbios aliases = sales, accounting, payroll 146netbios aliases = sales accounting payroll</pre><P CLASS="para"> 147In some values, however, you must use one form of separation - spaces in some cases, commas in others.</p></div><DIV CLASS="sect3"> 148<H4 CLASS="sect3"> 149<A CLASS="title" NAME="ch04-pgfId-960466"> 1504.1.1.2 Capitalization</a></h4><P CLASS="para">Capitalization is not important in the Samba configuration file except in locations where it would confuse the underlying operating system. For example, let's assume that you included the following option in a share that pointed to <I CLASS="filename"> 151/export/samba/simple </i>:</p><PRE CLASS="programlisting"> 152PATH = /EXPORT/SAMBA/SIMPLE</pre><P CLASS="para"> 153Samba would have no problem with the <CODE CLASS="literal"> 154path</code> configuration option appearing entirely in capital letters. However, when it tries to connect to the given directory, it would be unsuccessful because the Unix filesystem in the underlying operating system <EM CLASS="emphasis"> 155is</em> case sensitive. Consequently, the path listed would not be found and clients would be unable to connect to the share.</p></div><DIV CLASS="sect3"> 156<H4 CLASS="sect3"> 157<A CLASS="title" NAME="ch04-pgfId-960474"> 1584.1.1.3 Line continuation</a></h4><P CLASS="para"> 159You can continue a line in the Samba configuration file using the backslash, as follows:</p><PRE CLASS="programlisting"> 160comment = The first share that has the primary copies \ 161 of the new Teamworks software product.</pre><P CLASS="para"> 162Because of the backslash, these two lines will be treated as one line by Samba. The second line begins at the first non-whitespace character that Samba encounters; in this case, the <CODE CLASS="literal"> 163o</code> in <CODE CLASS="literal"> 164of</code>.</p></div><DIV CLASS="sect3"> 165<H4 CLASS="sect3"> 166<A CLASS="title" NAME="ch04-pgfId-955588"> 1674.1.1.4 Comments</a></h4><P CLASS="para"> 168You can insert comments in the <I CLASS="filename"> 169smb.conf</i> configuration file by preceding a line with either a hash mark (#) or a semicolon (;). Both characters are equivalent. For example, the first three lines in the following example would be considered comments:</p><PRE CLASS="programlisting"> 170# This is the printers section. We have given a minimum print 171; space of 2000 to prevent some errors that we've seen when 172; the spooler runs out of space. 173 174[printers] 175 public = yes 176 min print space = 2000</pre><P CLASS="para"> 177Samba will ignore all comment lines in its configuration file; there are no limitations to what can be placed on a comment line after the initial hash mark or semicolon. Note that the line continuation character (<CODE CLASS="literal">\</code>) will <EM CLASS="emphasis"> 178not</em> be honored on a commented line. Like the rest of the line, it is ignored.</p></div><DIV CLASS="sect3"> 179<H4 CLASS="sect3"> 180<A CLASS="title" NAME="ch04-pgfId-955563"> 1814.1.1.5 Changes at runtime</a></h4><P CLASS="para">You can modify the <I CLASS="filename"> 182smb.conf</i> configuration file and any of its options at any time while the Samba daemons are running. By default, Samba checks the configuration file every 60 seconds for changes. If it finds any, the changes are immediately put into effect. If you don't wish to wait that long, you can force a reload by either sending a SIGHUP signal to the <EM CLASS="emphasis"> 183smbd</em> and <EM CLASS="emphasis"> 184nmbd</em> processes, or simply restarting the daemons.</p><P CLASS="para"> 185For example, if the <EM CLASS="emphasis"> 186smbd</em> process was 893, you could force it to reread the configuration file with the following command:</p><PRE CLASS="programlisting"> 187<B CLASS="emphasis.bold"><CODE CLASS="literal">#</code> kill -SIGHUP 893</b></pre><P CLASS="para"> 188Not all changes will be immediately recognized by clients. For example, changes to a share that is currently in use will not be registered until the client disconnects and reconnects to that share. In addition, server-specific parameters such as the workgroup or NetBIOS name of the server will not register immediately either. This keeps active clients from being suddenly disconnected or encountering unexpected access problems while a session is open.<I CLASS="filename"> 189</i> </p></div></div><DIV CLASS="sect2"> 190<H3 CLASS="sect2"> 191<A CLASS="title" NAME="ch04-87365"> 1924.1.2 Variables</a></h3><P CLASS="para"> 193<I CLASS="filename"> 194</i>Samba includes a complete set of variables for determining characteristics of the Samba server and the clients to which it connects. Each of these variables begins with a percent sign, followed by a single uppercase or lowercase letter, and can be used only on the right side of a configuration option (e.g., after the equal sign):</p><PRE CLASS="programlisting"> 195[pub] 196 path = /home/ftp/pub/%a </pre><P CLASS="para"> 197The <CODE CLASS="literal"> 198%a</code> stands for the client machine's architecture (e.g., <CODE CLASS="literal"> 199WinNT</code> for Windows NT, <CODE CLASS="literal"> 200Win95</code> for Windows 95 or 98, or <CODE CLASS="literal"> 201WfWg</code> for Windows for Workgroups). Because of this, Samba will assign a unique path for the <CODE CLASS="literal"> 202[pub]</code> share to client machines running Windows NT, a different path for client machines running Windows 95, and another path for Windows for Workgroups. In other words, the paths that each client would see as its share differ according to the client's architecture, as follows:</p><PRE CLASS="programlisting"> 203/home/ftp/pub/WinNT 204/home/ftp/pub/Win95 205/home/ftp/pub/WfWg</pre><P CLASS="para"> 206Using variables in this manner comes in handy if you wish to have different users run custom configurations based on their own unique characteristics or conditions. Samba has 19 variables, as shown in <A CLASS="xref" HREF="ch04_01.html#ch04-10883"> 207Table 4.1</a>. </p><br> 208<TABLE CLASS="table" BORDER="1" CELLPADDING="3"> 209<CAPTION CLASS="table"> 210<A CLASS="title" NAME="ch04-10883"> 211Table 4.1: Samba Variables </a></caption><THEAD CLASS="thead"> 212<TR CLASS="row" VALIGN="TOP"> 213<TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 214<P CLASS="para"> 215Variable</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 216<P CLASS="para"> 217Definition</p></th></tr></thead><TBODY CLASS="tbody"> 218<TR CLASS="row" VALIGN="TOP"> 219<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 220<P CLASS="para"> 221<B CLASS="emphasis.bold">Client variables</b></p></td></tr><TR CLASS="row" VALIGN="TOP"> 222<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 223<P CLASS="para"> 224<CODE CLASS="literal"> 225%a</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 226<P CLASS="para"> 227<I CLASS="filename"> 228</i>Client's architecture (e.g., Samba, WfWg, WinNT, Win95, or UNKNOWN)</p></td></tr><TR CLASS="row" VALIGN="TOP"> 229<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 230<P CLASS="para"> 231<CODE CLASS="literal"> 232%I</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 233<P CLASS="para"> 234Client's IP address (e.g., 192.168.220.100)</p></td></tr><TR CLASS="row" VALIGN="TOP"> 235<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 236<P CLASS="para"> 237<CODE CLASS="literal">%m</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 238<P CLASS="para"> 239Client's NetBIOS name</p></td></tr><TR CLASS="row" VALIGN="TOP"> 240<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 241<P CLASS="para"> 242<CODE CLASS="literal"> 243%M</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 244<P CLASS="para"> 245Client's DNS name</p></td></tr><TR CLASS="row" VALIGN="TOP"> 246<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 247<P CLASS="para"> 248<B CLASS="emphasis.bold">User variables</b></p></td></tr><TR CLASS="row" VALIGN="TOP"> 249<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 250<P CLASS="para"> 251<CODE CLASS="literal"> 252%g</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 253<P CLASS="para"> 254Primary group of <CODE CLASS="literal"> 255%u</code></p></td></tr><TR CLASS="row" VALIGN="TOP"> 256<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 257<P CLASS="para"> 258<CODE CLASS="literal"> 259%G</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 260<P CLASS="para"> 261Primary group of <CODE CLASS="literal"> 262%U</code></p></td></tr><TR CLASS="row" VALIGN="TOP"> 263<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 264<P CLASS="para"> 265<CODE CLASS="literal"> 266%H</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 267<P CLASS="para"> 268Home directory of <CODE CLASS="literal"> 269%u</code></p></td></tr><TR CLASS="row" VALIGN="TOP"> 270<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 271<P CLASS="para"> 272<CODE CLASS="literal"> 273%u</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 274<P CLASS="para"> 275Current Unix username</p></td></tr><TR CLASS="row" VALIGN="TOP"> 276<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 277<P CLASS="para"> 278<CODE CLASS="literal"> 279%U</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 280<P CLASS="para"> 281Requested client username (not always used by Samba)</p></td></tr><TR CLASS="row" VALIGN="TOP"> 282<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 283<P CLASS="para"> 284<B CLASS="emphasis.bold"> 285Share variables</b></p></td></tr><TR CLASS="row" VALIGN="TOP"> 286<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 287<P CLASS="para"> 288<CODE CLASS="literal"> 289%p</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 290<P CLASS="para"> 291Automounter's path to the share's root directory, if different from <CODE CLASS="literal"> 292%P</code></p></td></tr><TR CLASS="row" VALIGN="TOP"> 293<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 294<P CLASS="para"> 295<CODE CLASS="literal"> 296%P</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 297<P CLASS="para"> 298Current share's root directory</p></td></tr><TR CLASS="row" VALIGN="TOP"> 299<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 300<P CLASS="para"> 301<CODE CLASS="literal"> 302%S</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 303<P CLASS="para"> 304Current share's name</p></td></tr><TR CLASS="row" VALIGN="TOP"> 305<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 306<P CLASS="para"> 307<B CLASS="emphasis.bold"> 308Server variables</b></p></td></tr><TR CLASS="row" VALIGN="TOP"> 309<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 310<P CLASS="para"> 311<CODE CLASS="literal"> 312%d</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 313<P CLASS="para"> 314Current server process ID</p></td></tr><TR CLASS="row" VALIGN="TOP"> 315<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 316<P CLASS="para"> 317<CODE CLASS="literal"> 318%h</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 319<P CLASS="para"> 320Samba server's DNS hostname</p></td></tr><TR CLASS="row" VALIGN="TOP"> 321<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 322<P CLASS="para"> 323<CODE CLASS="literal"> 324%L</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 325<P CLASS="para"> 326Samba server's NetBIOS name</p></td></tr><TR CLASS="row" VALIGN="TOP"> 327<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 328<P CLASS="para"> 329<CODE CLASS="literal"> 330%N</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 331<P CLASS="para"> 332Home directory server, from the automount map</p></td></tr><TR CLASS="row" VALIGN="TOP"> 333<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 334<P CLASS="para"> 335<CODE CLASS="literal"> 336%v</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 337<P CLASS="para"> 338Samba version</p></td></tr><TR CLASS="row" VALIGN="TOP"> 339<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 340<P CLASS="para"> 341<B CLASS="emphasis.bold"> 342Miscellaneous variables</b></p></td></tr><TR CLASS="row" VALIGN="TOP"> 343<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 344<P CLASS="para"> 345<CODE CLASS="literal"> 346%R</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 347<P CLASS="para"> 348The SMB protocol level that was negotiated</p></td></tr><TR CLASS="row" VALIGN="TOP"> 349<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 350<P CLASS="para"> 351<CODE CLASS="literal"> 352%T</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 353<P CLASS="para"> 354The current date and time</p></td></tr></tbody></table><P CLASS="para">Here's another example of using variables: let's say that there are five clients on your network, but one client, <CODE CLASS="literal"> 355fred</code>, requires a slightly different <CODE CLASS="literal"> 356[homes]</code> configuration loaded when it connects to the Samba server. With Samba, it's simple to attack such a problem: </p><PRE CLASS="programlisting"> 357[homes] 358 ... 359 include = /usr/local/samba/lib/smb.conf.%m 360 ...</pre><P CLASS="para"> 361The <CODE CLASS="literal"> 362include</code> option here causes a separate configuration file for each particular NetBIOS machine (<CODE CLASS="literal">%m</code>) to be read in addition to the current file. If the hostname of the client machine is <CODE CLASS="literal"> 363fred</code>, and if a <I CLASS="filename"> 364smb.conf.fred</i> file exists in the <CODE CLASS="replaceable"> 365<I> 366samba_dir</i></code><I CLASS="filename"> 367/lib/</i> directory (or whatever directory you've specified for your configuration files), Samba will insert that configuration file into the default one. If any configuration options are restated in <I CLASS="filename"> 368smb.conf.fred</i>, those values will override any options previously encountered in that share. Note that we say "previously." If any options are restated in the main configuration file after the <CODE CLASS="literal"> 369include</code> option, Samba will honor those restated values for the share in which they are defined.</p><P CLASS="para"> 370Here's the important part: if there is no such file, Samba will not generate an error. In fact, it won't do anything at all. This allows you to create only one extra configuration file for <CODE CLASS="literal"> 371fred</code> when using this strategy, instead of one for each NetBIOS machine that is on the network.</p><P CLASS="para"> 372Machine-specific configuration files can be used both to customize particular clients and to make debugging Samba easier. Consider the latter; if we have one client with a problem, we can use this approach to give it a private log file with a more verbose logging level. This allows us to see what Samba is doing without slowing down all the other clients or overflowing the disk with useless logs. Remember, with large networks you may not always have the option to restart the Samba server to perform debugging!</p><P CLASS="para"> 373You can use each of the variables in <A CLASS="xref" HREF="ch04_01.html#ch04-10883"> 374Table 4.1</a> to give custom values to a variety of Samba options. We will highlight several of these options as we move through the next few chapters.<I CLASS="filename"> 375</i> </p></div></div></div></blockquote> 376<div> 377<center> 378<hr noshade size=1><TABLE WIDTH="515" BORDER="0" CELLSPACING="0" CELLPADDING="0"> 379<TR> 380<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172"> 381<A CLASS="sect1" HREF="ch03_03.html" TITLE="3.3 An Introduction to SMB/CIFS"> 382<IMG SRC="gifs/txtpreva.gif" ALT="Previous: 3.3 An Introduction to SMB/CIFS" BORDER="0"></a></td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171"> 383<A CLASS="book" HREF="index.html" TITLE=""> 384<IMG SRC="gifs/txthome.gif" ALT="" BORDER="0"></a></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172"> 385<A CLASS="sect1" HREF="ch04_02.html" TITLE="4.2 Special Sections"> 386<IMG SRC="gifs/txtnexta.gif" ALT="Next: 4.2 Special Sections" BORDER="0"></a></td></tr><TR> 387<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172"> 3883.3 An Introduction to SMB/CIFS</td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171"> 389<A CLASS="index" HREF="inx.html" TITLE="Book Index"> 390<IMG SRC="gifs/index.gif" ALT="Book Index" BORDER="0"></a></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172"> 3914.2 Special Sections</td></tr></table><hr noshade size=1></center> 392</div> 393 394<!-- End of sample chapter --> 395<CENTER> 396<FONT SIZE="1" FACE="Verdana, Arial, Helvetica"> 397<A HREF="http://www.oreilly.com/"> 398<B>O'Reilly Home</B></A> <B> | </B> 399<A HREF="http://www.oreilly.com/sales/bookstores"> 400<B>O'Reilly Bookstores</B></A> <B> | </B> 401<A HREF="http://www.oreilly.com/order_new/"> 402<B>How to Order</B></A> <B> | </B> 403<A HREF="http://www.oreilly.com/oreilly/contact.html"> 404<B>O'Reilly Contacts<BR></B></A> 405<A HREF="http://www.oreilly.com/international/"> 406<B>International</B></A> <B> | </B> 407<A HREF="http://www.oreilly.com/oreilly/about.html"> 408<B>About O'Reilly</B></A> <B> | </B> 409<A HREF="http://www.oreilly.com/affiliates.html"> 410<B>Affiliated Companies</B></A><p> 411<EM>© 1999, O'Reilly & Associates, Inc.</EM> 412</FONT> 413</CENTER> 414</BODY> 415</html> 416