• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt/router/samba/docs/htmldocs/using_samba/
1<HTML>
2<HEAD>
3<TITLE>
4[Chapter 4] 4.3 Configuration File Options</title><META NAME="DC.title" CONTENT=""><META NAME="DC.creator" CONTENT=""><META NAME="DC.publisher" CONTENT="O'Reilly &amp; Associates, Inc."><META NAME="DC.date" CONTENT="1999-11-05T21:32:06Z"><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="ch04_02.html" TITLE="4.2 Special Sections">
35<IMG SRC="gifs/txtpreva.gif" ALT="Previous: 4.2 Special Sections" 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="ch04_01.html" TITLE="4. Disk Shares ">
39Chapter 4<br>
40Disk Shares </a></font></b></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172">
41<A CLASS="sect1" HREF="ch04_04.html" TITLE="4.4 Server Configuration">
42<IMG SRC="gifs/txtnexta.gif" ALT="Next: 4.4 Server Configuration" BORDER="0"></a></td></tr></table>&nbsp;<hr noshade size=1></center>
43</div>
44<blockquote>
45<div>
46<H2 CLASS="sect1">
47<A CLASS="title" NAME="ch04-46076">
484.3 Configuration File Options</a></h2><P CLASS="para">
49Samba has well over 200 configuration options at its disposal. So let's start off easy by introducing some of the options you can use to modify the configuration file itself. </p><P CLASS="para">
50As we hinted earlier in the chapter, configuration files are by no means static. You can instruct Samba to include or even replace configuration options as it is processing them. The options to do this are summarized in <A CLASS="xref" HREF="ch04_03.html#ch04-94939">
51Table 4.2</a>. </p><br>
52<TABLE CLASS="table" BORDER="1" CELLPADDING="3">
53<CAPTION CLASS="table">
54<A CLASS="title" NAME="ch04-94939">
55Table 4.2: Configuration File Options </a></caption><THEAD CLASS="thead">
56<TR CLASS="row" VALIGN="TOP">
57<TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1">
58<P CLASS="para">
59Option</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1">
60<P CLASS="para">
61Parameters</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1">
62<P CLASS="para">
63Function</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1">
64<P CLASS="para">
65Default</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1">
66<P CLASS="para">
67Scope</p></th></tr></thead><TBODY CLASS="tbody">
68<TR CLASS="row" VALIGN="TOP">
69<TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
70<P CLASS="para">
71<CODE CLASS="literal">
72config file</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
73<P CLASS="para">
74string (fully-qualified name)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
75<P CLASS="para">
76Sets the location of a configuration file to use instead of the current one.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
77<P CLASS="para">
78None</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
79<P CLASS="para">
80Global</p></td></tr><TR CLASS="row" VALIGN="TOP">
81<TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
82<P CLASS="para">
83<CODE CLASS="literal">
84include</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
85<P CLASS="para">
86string (fully-qualified name)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
87<P CLASS="para">
88Specifies an additional segment of configuration options to be included at this point in the configuration file.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
89<P CLASS="para">
90None</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
91<P CLASS="para">
92Global</p></td></tr><TR CLASS="row" VALIGN="TOP">
93<TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
94<P CLASS="para">
95<CODE CLASS="literal">
96copy</code></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
97<P CLASS="para">
98string (name of share)</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
99<P CLASS="para">
100Allows you to clone the configuration options of another share in the current share.</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
101<P CLASS="para">
102None</p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1">
103<P CLASS="para">
104Share</p></td></tr></tbody></table><DIV CLASS="sect2">
105<H3 CLASS="sect2">
106<A CLASS="title" NAME="ch04-pgfId-960146">
1074.3.1 config file</a></h3><P CLASS="para">
108The global <CODE CLASS="literal">
109config</code> <CODE CLASS="literal">
110file</code> option specifies a replacement configuration file that will be loaded when the option is encountered. If the target file exists, the remainder of the current configuration file, as well as the options encounter so far, will be discarded; Samba will configure itself entirely with the options in the new file. The <CODE CLASS="literal">
111config</code> <CODE CLASS="literal">
112file</code> option takes advantage of the variables above, which is useful in the event that you want load a special configuration file based on the machine name or user of the client that it connecting. </p><P CLASS="para">
113For example, the following line instructs Samba to use a configuration file specified by the NetBIOS name of the client connecting, if such a file exists. If it does, options specified in the original configuration file are ignored. The following example attempts to lead a new configuration file based on the client's NetBIOS name: </p><PRE CLASS="programlisting">
114[global]
115	config file = /usr/local/samba/lib/smb.conf.%m</pre><P CLASS="para">
116If the configuration file specified does not exist, the option is ignored and Samba will continue to configure itself based on the current file.</p></div><DIV CLASS="sect2">
117<H3 CLASS="sect2">
118<A CLASS="title" NAME="ch04-pgfId-960151">
1194.3.2 include</a></h3><P CLASS="para">
120This option, discussed in greater detail earlier, copies the target file into the current configuration file at the point specified, as shown in <A CLASS="xref" HREF="ch04_03.html#ch04-97340">
121Figure 4.1</a>. This option also takes advantage of the variables specified earlier in the chapter, which is useful in the event that you want load configuration options based on the machine name or user of the client that it connecting. You can use this option as follows:</p><PRE CLASS="programlisting">
122[global]
123	include = /usr/local/samba/lib/smb.conf.%m</pre><P CLASS="para">
124If the configuration file specified does not exist, the option is ignored. Remember that any option specified previously is overridden. In <A CLASS="xref" HREF="ch04_03.html#ch04-97340">
125Figure 4.1</a>, all three options will override their previous values.   </p><H4 CLASS="figure">
126<A CLASS="title" NAME="ch04-97340">
127Figure 4.1: The include option in a Samba configuration file</a></h4><IMG CLASS="graphic" SRC="figs/sam.0401.gif" ALT="Figure 4.1"><P CLASS="para">
128The <CODE CLASS="literal">
129include</code> option cannot understand the variables <CODE CLASS="literal">
130%u</code> (user), <CODE CLASS="literal">
131%p</code> (current share's rout directory), or <CODE CLASS="literal">
132%s</code> (current share) because they are not set at the time the file is read.</p></div><DIV CLASS="sect2">
133<H3 CLASS="sect2">
134<A CLASS="title" NAME="ch04-pgfId-960290">
1354.3.3 copy</a></h3><P CLASS="para">
136The <CODE CLASS="literal">
137copy</code> configuration option allows you to clone the configuration options of the share name that you specify in the current share. The target share must appear earlier in the configuration file than the share that is performing the copy. For example:</p><PRE CLASS="programlisting">
138[template]
139	writable = yes
140	browsable = yes
141	valid users = andy, dave, peter
142
143[data]
144	path = /usr/local/samba
145	copy = template</pre><P CLASS="para">
146Note that any options in the share that invoked the <CODE CLASS="literal">
147copy</code> directive will override those in the cloned share; it does not matter whether they appear before or after the <CODE CLASS="literal">
148copy</code><I CLASS="filename">
149</i> directive.<I CLASS="filename">
150</i> </p></div></div></blockquote>
151<div>
152<center>
153<hr noshade size=1><TABLE WIDTH="515" BORDER="0" CELLSPACING="0" CELLPADDING="0">
154<TR>
155<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172">
156<A CLASS="sect1" HREF="ch04_02.html" TITLE="4.2 Special Sections">
157<IMG SRC="gifs/txtpreva.gif" ALT="Previous: 4.2 Special Sections" BORDER="0"></a></td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171">
158<A CLASS="book" HREF="index.html" TITLE="">
159<IMG SRC="gifs/txthome.gif" ALT="" BORDER="0"></a></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172">
160<A CLASS="sect1" HREF="ch04_04.html" TITLE="4.4 Server Configuration">
161<IMG SRC="gifs/txtnexta.gif" ALT="Next: 4.4 Server Configuration" BORDER="0"></a></td></tr><TR>
162<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172">
1634.2 Special Sections</td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171">
164<A CLASS="index" HREF="inx.html" TITLE="Book Index">
165<IMG SRC="gifs/index.gif" ALT="Book Index" BORDER="0"></a></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172">
1664.4 Server Configuration</td></tr></table><hr noshade size=1></center>
167</div>
168
169<!-- End of sample chapter -->
170<CENTER>
171<FONT SIZE="1" FACE="Verdana, Arial, Helvetica">
172<A HREF="http://www.oreilly.com/">
173<B>O'Reilly Home</B></A> <B> | </B>
174<A HREF="http://www.oreilly.com/sales/bookstores">
175<B>O'Reilly Bookstores</B></A> <B> | </B>
176<A HREF="http://www.oreilly.com/order_new/">
177<B>How to Order</B></A> <B> | </B>
178<A HREF="http://www.oreilly.com/oreilly/contact.html">
179<B>O'Reilly Contacts<BR></B></A>
180<A HREF="http://www.oreilly.com/international/">
181<B>International</B></A> <B> | </B>
182<A HREF="http://www.oreilly.com/oreilly/about.html">
183<B>About O'Reilly</B></A> <B> | </B>
184<A HREF="http://www.oreilly.com/affiliates.html">
185<B>Affiliated Companies</B></A><p>
186<EM>&copy; 1999, O'Reilly &amp; Associates, Inc.</EM>
187</FONT>
188</CENTER>
189</BODY>
190</html>
191