• 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>Appendix D</title>
4</head>
5
6<BODY BGCOLOR="#FFFFFF" TEXT="#000000" link="#990000" vlink="#0000CC">
7<table BORDER="0" CELLPADDING="0" CELLSPACING="0" width="90%">
8<tr>
9<td width="25%" valign="TOP">
10<img hspace=10 vspace=10 src="gifs/samba.s.gif" 
11alt="Using Samba" align=left valign=top border=0>
12</td>
13<td height="105" valign="TOP">
14<br>
15<H2>Using Samba</H2>
16<font size="-1">
17Robert Eckstein, David Collier-Brown, Peter Kelly
18<br>1st Edition November 1999
19<br>1-56592-449-5, Order Number: 4495
20<br>416 pages, $34.95
21</font>
22<p> <a href="http://www.oreilly.com/catalog/samba/">Buy the hardcopy</a>
23<p><a href="index.html">Table of Contents</a>
24</td>
25</tr>
26</table>
27<hr size=1 noshade>
28<!--sample chapter begins -->
29
30<center>
31<DIV CLASS="htmlnav">
32<TABLE WIDTH="515" BORDER="0" CELLSPACING="0" CELLPADDING="0">
33<TR>
34<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172">
35<A CLASS="sect1" HREF="appc_01.html" TITLE="C. Samba Configuration Option Quick Reference">
36<IMG SRC="gifs/txtpreva.gif" ALT="Previous: C. Samba Configuration Option Quick Reference" BORDER="0"></a></td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171">
37<B>
38<FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1">
39Appendix D</font></b></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172">
40<A CLASS="appendix" HREF="appe_01.html" TITLE="E. Downloading Samba with CVS">
41<IMG SRC="gifs/txtnexta.gif" ALT="Next: E. Downloading Samba with CVS" BORDER="0"></a></td></tr></table>&nbsp;<hr noshade size=1></center>
42</div>
43
44<blockquote>
45<div class="samplechapter">
46<h1>Appendix D<br>
47Summary of Samba Daemons and Commands</h1>
48
49<p>
50This appendix is a reference listing of command-line options and other information to help you use the executables that come with Samba distribution.
51
52<DIV>
53<H2 CLASS="FM-HeadA">Samba Distribution Programs</h2>
54<P CLASS="Body">The following sections provide information about the command-line parameters for Samba programs.</p>
55<DIV>
56<H3 CLASS="HeadB">smbd</h3>
57<P CLASS="Body">The <EM CLASS="Emphasis">smbd</em>
58 program provides Samba's file and printer services, using one TCP/IP stream and one daemon per client. It is controlled from the default configuration file, <EM CLASS="Replaceable">samba_dir</em><EM CLASS="Emphasis">/lib/smb.conf</em>, and can be overridden by command-line options.</p>
59<P CLASS="Body">The configuration file is automatically re-evaluated every minute. If it has changed, most new options are immediately effective. You can force Samba to immediately reload the configuration file if you send a SIGHUP to <EM CLASS="Emphasis">smbd</em>
60. Reloading the configuration file, however, will not affect any clients that are already connected. To escape this &quot;grandfather&quot; configuration, a client would need to disconnect and reconnect, or the server itself would have to be restarted, forcing all clients to reconnect.</p>
61<DIV>
62<H4 CLASS="HeadC">Other signals</h4>
63<P CLASS="Body">To shut down a <EM CLASS="Emphasis">smbd</em>
64 process, send it the termination signal SIGTERM (-15) which allows it to die gracefully instead of a SIGKILL (-9). To increment the debug logging level of <EM CLASS="Emphasis">smbd</em>
65 at runtime, send the program a SIGUSR1 signal. To decrement it at runtime, send the program a SIGUSR2 signal. </p>
66</div>
67<DIV>
68<H4 CLASS="HeadC">Command-line options</h4>
69</div>
70<DIV>
71<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-D</em>
72</h4>
73<UL>
74<LI CLASS="ListVariable">The <EM CLASS="Emphasis">smbd</em>
75 program is run as a daemon. This is the recommended way to use <EM CLASS="Emphasis">smbd</em> (it is also the default action). In addition, <EM CLASS="Emphasis">smbd</em> can also be run from <EM CLASS="Emphasis">inetd</em>.</li>
76</ul>
77</div>
78<DIV>
79<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-d</em>
80 <EM CLASS="Replaceable">debuglevel</em>
81</h4>
82<UL>
83<LI CLASS="ListVariable">Sets the debug (sometimes called logging) level. The level can range from 0 all the way to 10. Specifying the value on the command line overrides the value specified in the <EM CLASS="Filename">smb.conf</em>
84 file. Debug level 0 logs only the most important messages; level 1 is normal; levels 3 and above are primarily for debugging and slow <EM CLASS="Emphasis">smbd</em>
85 considerably.</li>
86</ul>
87<DIV>
88<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-h</em>
89 </h4>
90<UL>
91<LI CLASS="ListVariable">Prints command-line usage information for the <EM CLASS="Filename">smbd</em>
92 program.</li>
93</ul>
94<DIV>
95<H4 CLASS="HeadC">Testing/debugging options</h4>
96</div>
97</div>
98<DIV>
99<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-a</em>
100</h4>
101<UL>
102<LI CLASS="ListVariable">If this is specified, each new connection to the Samba server will append all logging messages to the log file. This option is the opposite of <EM CLASS="Literal">-o</em>, and is the default.</li>
103</ul>
104</div>
105<DIV>
106<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-i</em>
107 <EM CLASS="Replaceable">scope</em>
108</h4>
109<UL>
110<LI CLASS="ListVariable">&nbsp;</li>
111<LI CLASS="ListVariable">This sets a NetBIOS scope identifier. Only machines with the same identifier will communicate with the server. The scope identifier was a predecessor to workgroups, and this option is included only for backwards compatibility.</li>
112</ul>
113</div>
114</div>
115<DIV>
116<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-l</em>
117 <EM CLASS="Replaceable">log_file</em>
118</h4>
119<UL>
120<LI CLASS="ListVariable">Send the log messages to somewhere other than the location compiled in or specified in the <EM CLASS="Filename">smb.conf</em> file. The default is often <EM CLASS="Filename">/usr/local/samba/var/log.smb</em>, <EM CLASS="Filename">/usr/samba/var/log.smb,</em> or <EM CLASS="Filename">/var/log/log.smb</em>. The first two are strongly discouraged on Linux, where <EM CLASS="Filename">/usr</em>
121 may be a read-only filesystem. </li>
122</ul>
123</div>
124<DIV>
125<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-O</em>
126 <EM CLASS="Replaceable">socket_options</em>
127</h4>
128<UL>
129<LI CLASS="ListVariable">This sets the TCP/IP socket options, using the same parameters as the <EM CLASS="Literal">socket</em>
130 <EM CLASS="Literal">options</em>
131 configuration option. It is often used for performance tuning and testing.</li>
132</ul>
133<DIV>
134<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-o</em>
135</h4>
136<UL>
137<LI CLASS="ListVariable">This option is the opposite of <EM CLASS="Literal">-a</em>. It causes log files to be overwritten when opened. Using this option saves hunting for the right log entries if you are performing a series of tests and inspecting the log file each time.</li>
138</ul>
139</div>
140<DIV>
141<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-P</em>
142</h4>
143<UL>
144<LI CLASS="ListVariable">This option forces <EM CLASS="Filename">smbd</em>
145 not to send any network data out. This option is typically used only by Samba developers.</li>
146</ul>
147</div>
148<DIV>
149<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-P</em>
150</h4>
151<UL>
152<LI CLASS="ListVariable">This option forces <EM CLASS="Filename">smbd</em>
153 not to send any network data out. This option is typically used only by Samba developers.  </li>
154</ul>
155</div>
156</div>
157<DIV>
158<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-p</em>
159 <EM CLASS="Replaceable">port_number</em>
160</h4>
161<UL>
162<LI CLASS="ListVariable">This sets the TCP/IP port number that the server will accept requests from. Currently, all Microsoft clients send only to the default port: 139.</li>
163</ul>
164</div>
165<DIV>
166<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-s</em>
167 <EM CLASS="Replaceable">configuration_file</em>
168</h4>
169<UL>
170<LI CLASS="ListVariable">Specifies the location of the Samba configuration file. Although the file defaults to <EM CLASS="Filename">/usr/local/samba/lib/smb.conf</em>, you can override it here on the command line, typically for debugging.</li>
171</ul>
172</div>
173</div>
174<DIV>
175<H3 CLASS="HeadB">nmbd</h3>
176<P CLASS="Body">The <EM CLASS="Emphasis">nmbd</em>
177 program is Samba's NetBIOS name and browsing daemon. It replies to broadcast NetBIOS over TCP/IP (NBT) name-service requests from SMB clients and optionally to Microsoft's Windows Internet Name Service (WINS) requests. Both of these are versions of the name-to-address lookup required by SMB clients. The broadcast version uses UDP/IP broadcast on the local subnet only, while WINS uses TCP/IP, which may be routed. If running as a WINS server, <EM CLASS="Emphasis">nmbd</em>
178 keeps a current name and address database in the file <EM CLASS="Filename">wins.dat</em> in the <EM CLASS="Literal">samba_dir</em><EM CLASS="Filename">/var/locks</em> directory.</p>
179<P CLASS="Body">An active <EM CLASS="Emphasis">nmbd</em>
180 program can also respond to browsing protocol requests used by the Windows Network Neighborhood. Browsing is a combined advertising, service announcement, and active directory protocol. This protocol provides a dynamic directory of servers and the disks and printers that the servers are providing. As with WINS, this was initially done by making UDP/IP broadcasts on the local subnet. Now, with the concept of a local master browser, it is done by making TCP/IP connections to a server. If <EM CLASS="Emphasis">nmbd</em>
181 is acting as a local master browser, it stores the browsing database in the file <EM CLASS="Filename">browse.dat</em> in the <EM CLASS="Literal">samba_dir</em><EM CLASS="Filename">/var/locks</em> directory.</p>
182<DIV>
183<H4 CLASS="HeadC">Signals</h4>
184<P CLASS="Body">Like <EM CLASS="Emphasis">smbd</em>, the <EM CLASS="Emphasis">nmbd</em> program responds to several Unix signals. Sending <EM CLASS="Emphasis">nmbd</em>
185 a SIGHUP signal will cause it to dump the names it knows about to the file <EM CLASS="Filename">namelist.debug</em>
186 in the <EM CLASS="Literal">samba_dir</em>
187/<EM CLASS="Emphasis">locks</em>
188 directory and its browsing database to the <EM CLASS="Filename">browse.dat </em>
189file in the same directory. To shut down a <EM CLASS="Emphasis">nmbd</em>
190 process send it a SIGTERM (-15) signal instead of a SIGKILL (-9) to allow it to die gracefully. You can increment the debug logging level of <EM CLASS="Emphasis">nmbd</em>
191 by sending it a SIGUSR1 signal; you can decrement it by sending a SIGUSR2 signal.</p>
192</div>
193<DIV>
194<H4 CLASS="HeadC">Command-line options</h4>
195</div>
196<DIV>
197<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-D</em>
198</h4>
199<UL>
200<LI CLASS="ListVariable">Instructs the <EM CLASS="Filename">nmbd</em>
201 program to run as a daemon. This is the recommended way to use <EM CLASS="Filename">nmbd</em>. In addition, <EM CLASS="Filename">nmbd</em> can also be run from <EM CLASS="FirstTerm">inetd</em>.</li>
202</ul>
203</div>
204<DIV>
205<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-d</em>
206 <EM CLASS="Replaceable">debuglevel</em>
207</h4>
208<UL>
209<LI CLASS="ListVariable">Sets the debug (sometimes called logging) level. The level can range from 0, all the way to 10. Specifying the value on the command line overrides the value specified in the <EM CLASS="Filename">smb.conf</em>
210 file. Debug level 0 logs only the most important messages; level 1 is normal; level 3 and above are primarily for debugging, and slow <EM CLASS="Emphasis">nmbd</em>
211 considerably.</li>
212</ul>
213<DIV>
214<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-h</em>
215 </h4>
216<UL>
217<LI CLASS="ListVariable">Prints command-line usage information for the <EM CLASS="Filename">nmbd</em> program (also <EM CLASS="Literal">-?</em>).</li>
218</ul>
219<DIV>
220<H4 CLASS="HeadC">Testing/debugging options</h4>
221</div>
222</div>
223<DIV>
224<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-a</em>
225</h4>
226<UL>
227<LI CLASS="ListVariable">If this is specified, each new connection to the Samba server will append all logging messages to the log file. This option is the opposite of <EM CLASS="Literal">-o</em>, and is the default.</li>
228</ul>
229</div>
230</div>
231<DIV>
232<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-H</em>
233 <EM CLASS="Replaceable">hosts_  file</em>
234</h4>
235<UL>
236<LI CLASS="ListVariable">This option loads a standard <EM CLASS="Emphasis">hosts</em>
237 file for name resolution. </li>
238</ul>
239</div>
240<DIV>
241<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-i</em>
242 <EM CLASS="Replaceable">scope</em>
243</h4>
244<UL>
245<LI CLASS="ListVariable">This sets a NetBIOS scope identifier. Only machines with the same identifier will communicate with the server. The scope identifier was a predecessor to workgroups, and this option is included only for backward compatibility.</li>
246</ul>
247</div>
248<DIV>
249<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-l</em>
250 <EM CLASS="Replaceable">log_file</em>
251</h4>
252<UL>
253<LI CLASS="ListVariable">Sends the log messages to somewhere other than the location compiled-in or specified in the <EM CLASS="Filename">smb.conf</em> file. The default is often <EM CLASS="Filename">/usr/local/samba/var/log.nmb</em>, <EM CLASS="Filename">/usr/samba/var/log.nmb,</em> or <EM CLASS="Filename">/var/log/log.nmb</em>. The first two are strongly discouraged on Linux, where <EM CLASS="Filename">/usr</em>
254 may be a read-only filesystem. </li>
255</ul>
256</div>
257<DIV>
258<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-n</em>
259 <EM CLASS="Replaceable">NetBIOS_name</em>
260</h4>
261<UL>
262<LI CLASS="ListVariable">This option allows you to override the NetBIOS name by which the daemon will advertise itself. Specifying the option on the command line overrides the <EM CLASS="Literal">netbios</em>
263 <EM CLASS="Literal">name</em>
264 option in the Samba configuration file.</li>
265</ul>
266</div>
267<DIV>
268<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-O</em>
269 <EM CLASS="Replaceable">socket_options</em>
270</h4>
271<UL>
272<LI CLASS="ListVariable">This sets the TCP/IP socket options, using the same parameters as the <EM CLASS="Literal">socket</em>
273 <EM CLASS="Literal">options</em>
274 configuration option. It is often used for performance tuning and testing.</li>
275</ul>
276<DIV>
277<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-o</em>
278</h4>
279<UL>
280<LI CLASS="ListVariable">This option is the opposite of <EM CLASS="Literal">-a</em>
281. It causes log files to be overwritten when opened. Using this option saves hunting for the right log entries if you are performing a series of tests and inspecting the log file each time.</li>
282</ul>
283</div>
284</div>
285<DIV>
286<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-p</em>
287 <EM CLASS="Replaceable">port_number</em>
288</h4>
289<UL>
290<LI CLASS="ListVariable">This sets the UDP/IP port number from which the server will accept requests. Currently, all Microsoft clients send only to the default port: 137.</li>
291</ul>
292</div>
293<DIV>
294<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-s</em>
295 <EM CLASS="Replaceable">configuration_file</em>
296</h4>
297<UL>
298<LI CLASS="ListVariable">Specifies the location of the Samba configuration file. Although the file defaults to <EM CLASS="Filename">/usr/local/samba/lib/smb.conf</em>, you can override it here on the command line, typically for debugging.</li>
299</ul>
300</div>
301<DIV>
302<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-v</em>
303</h4>
304<UL>
305<LI CLASS="ListVariable">This option prints the current version of Samba.</li>
306</ul>
307</div>
308</div>
309<DIV>
310<H3 CLASS="HeadB">Samba Startup File </h3>
311<P CLASS="Body">Samba is normally started by running it from your Unix system's <EM CLASS="Filename">rc</em>
312 files at boot time. For systems with a System V-like set of <EM CLASS="Filename">/etc/rcN.d</em>
313 directories, this can be done by placing a suitably named script in the <EM CLASS="Filename">/rc</em>
314 directory. Usually, the script  starting Samba is called <EM CLASS="Emphasis">S91samba</em>
315, while the script stopping or &quot;killing&quot; Samba is called <EM CLASS="Emphasis">K91samba. </em>
316On Linux, the usual subdirectory for the scripts is <EM CLASS="Filename">/etc/rc2.d.</em>
317 On Solaris, the directory is <EM CLASS="Filename">/etc/rc3.d</em>
318. For machines with <EM CLASS="Filename">/etc/rc.local</em>
319 files, you would normally add the following lines to that file:</p>
320<P CLASS="Code">/usr/local/samba/bin/smbd -D</p>
321<P CLASS="Code">/usr/local/samba/bin/nmbd -D </p>
322<P CLASS="Body">The following example script supports two extra commands, <EM CLASS="Literal">status</em>
323 and <EM CLASS="Literal">restart</em>, in addition to the normal <EM CLASS="Literal">start</em>
324 and <EM CLASS="Literal">stop</em>
325 for System V machines:</p>
326
327<pre>
328#!/bin/sh
329#
330# /etc/rc2.d./S91Samba  --manage the SMB server in a System V manner
331#
332OPTS=&quot;-D&quot;
333#DEBUG=-d3
334PS=&quot;ps  ax&quot;
335SAMBA_DIR=/usr/local/samba
336case &quot;$1&quot; in
337'start')
338	echo &quot;samba &quot;
339	$SAMBA_DIR/bin/smbd $OPTS $DEBUG
340	$SAMBA_DIR/bin/nmbd $OPTS $DEBUG
341	;;
342'stop')
343	echo &quot;Stopping samba&quot;
344	$PS | awk '/usr.local.samba.bin/ { print $1}' |&#92;
345	xargs kill
346	;;
347'status')
348	x=`$PS | grep -v grep | grep '$SAMBA_DIR/bin'`
349	if [ ! &quot;$x&quot; ]; then
350		echo &quot;No samba processes running&quot;
351	else
352		echo &quot;  PID TT STAT  TIME COMMAND&quot;
353		echo &quot;$x&quot;
354	fi
355	;;
356'restart')
357	/etc/rc2.d/S91samba stop
358	/etc/rc2.d/S91samba start
359	/etc/rc2.d/S91samba status
360	;;
361*)
362	echo &quot;$0: Usage error -- you must say $0 start, stop, status or restart.&quot;
363	;;
364esac
365exit
366</pre>
367<P CLASS="Body">You'll need to set the actual paths and <EM CLASS="Literal">ps</em>
368 options to suit the machine you're using. In addition, you might want to add additional commands to tell Samba to reload its <EM CLASS="Filename">smb.conf</em>
369 file or dump its <EM CLASS="Emphasis">nmbd</em>
370 tables, depending on your actual needs. </p>
371</div>
372<DIV>
373<H3 CLASS="HeadB">smbsh</h3>
374<P CLASS="Body">The <EM CLASS="Emphasis">smbsh</em>
375 program lets you use a remote Windows share on your Samba server as if the share was a regular Unix directory. When it's run, it provides an extra directory tree under <EM CLASS="Filename">/smb</em>. Subdirectories of <EM CLASS="Filename">/smb</em>
376 are servers, and subdirectories of the servers are their individual disk and printer shares. Commands run by <EM CLASS="Emphasis">smbsh</em>
377 treat the <EM CLASS="Filename">/smb</em>
378 filesystem as if it were local to Unix. This means that you don't need <EM CLASS="Emphasis">smbmount</em>
379 in your kernel to mount Windows filesystems the way you mount with NFS filesystems. However, you do need to configure Samba with the <EM CLASS="Literal">--with-smbwrappers</em>
380 option to enable <EM CLASS="Filename">smbsh</em>.</p>
381<DIV>
382<H4 CLASS="HeadC">Options</h4>
383</div>
384<DIV>
385<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-d</em>
386 debuglevel</h4>
387<UL>
388<LI CLASS="ListVariable">Sets the debug (sometimes called logging) level. The level can range from 0, the default, all the way to 10. Debug level 0 logs only the most important messages; level 1 is normal; level 3 and above are primarily for debugging, and slow <EM CLASS="Emphasis">smbsh</em>
389 considerably.</li>
390</ul>
391</div>
392<DIV>
393<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-l</em>
394 <EM CLASS="Replaceable">logfile</em>
395</h4>
396<UL>
397<LI CLASS="ListVariable">Sets the name of the logfile to use.</li>
398</ul>
399</div>
400<DIV>
401<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-P</em>
402 <EM CLASS="Replaceable">prefix</em>
403</h4>
404<UL>
405<LI CLASS="ListVariable">Sets the root directory to mount the SMB filesystem. The default is <EM CLASS="Filename">/smb</em>.</li>
406</ul>
407</div>
408<DIV>
409<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-R</em>
410 <EM CLASS="Replaceable">resolve order</em>
411</h4>
412<UL>
413<LI CLASS="ListVariable">Sets the resolve order of the name servers. This option is similar to the <EM CLASS="Literal">resolve order</em>
414 configuration option, and can take any of the four parameters, <EM CLASS="Literal">lmhosts</em>, <EM CLASS="Literal">host</em>, <EM CLASS="Literal">wins</em>, and <EM CLASS="Literal">bcast</em>, in any order.</li>
415</ul>
416</div>
417<DIV>
418<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-U</em>
419 <EM CLASS="Replaceable">user</em>
420</h4>
421<UL>
422<LI CLASS="ListVariable">Supports <EM CLASS="Replaceable">user%password.</em>
423</li>
424</ul>
425</div>
426<DIV>
427<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-W</em>
428 <EM CLASS="Replaceable">workgroup</em>
429</h4>
430<UL>
431<LI CLASS="ListVariable">Sets the NetBIOS workgroup to which the client will connect.</li>
432</ul>
433</div>
434</div>
435<DIV>
436<H3 CLASS="HeadB">smbclient</h3>
437<P CLASS="Body">The <EM CLASS="Emphasis">smbclient</em>
438 program is the maid-of-all-work of the Samba suite. Initially intended as a testing tool, it has become a full command-line Unix client, with an FTP-like interactive client. Some of its options are still used for testing and tuning, and it makes a simple tool for ensuring that Samba is running on a server.</p>
439<P CLASS="Body">It's convenient to look at <EM CLASS="Emphasis">smbclient</em>
440 as a suite of programs:</p>
441<UL>
442<LI CLASS="ListBullet">FTP-like interactive file transfer program</li>
443<LI CLASS="ListBullet">Interactive printing program</li>
444<LI CLASS="ListBullet">Interactive tar program </li>
445<LI CLASS="ListBullet">Command-line message program</li>
446<LI CLASS="ListBullet">Command-line <EM CLASS="Emphasis">tar</em>
447 program (but see <EM CLASS="Emphasis">smbtar</em>
448 later)</li>
449<LI CLASS="ListBullet">&quot;What services do you have&quot; query program</li>
450<LI CLASS="ListBullet">Command-line debugging program</li>
451</ul>
452<DIV>
453<H4 CLASS="HeadC">General command-line options</h4>
454<P CLASS="Body">The program has the usual set of <EM CLASS="Emphasis">smbd</em>
455-like options, which apply to all the interactive and command-line use. The syntax is:</p>
456<P CLASS="Code">smbclient //<EM CLASS="Replaceable">server_name</em>
457/<EM CLASS="Replaceable">share_name</em>
458 [<EM CLASS="Replaceable">password</em>
459] [-<EM CLASS="Replaceable">options</em>
460]</p>
461<P CLASS="Body">Here is an explanation of each of the command-line options:</p>
462</div>
463<DIV>
464<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-d</em>
465 <EM CLASS="Replaceable">debug_level</em>
466</h4>
467<UL>
468<LI CLASS="ListVariable">Sets the debug (logging) level, from 0 to 10, with <EM CLASS="Literal">A</em>
469 for all. Overrides the value in <EM CLASS="Filename">smb.conf</em>. Debug level 0 logs only the most important messages; level 1 is normal; debug level 3 and above are for debugging, and slow <EM CLASS="Emphasis">smbclient</em>
470 considerably.</li>
471</ul>
472<DIV>
473<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-h</em>
474</h4>
475<UL>
476<LI CLASS="ListVariable">Prints the command-line help information (usage) for smbclient.</li>
477</ul>
478</div>
479</div>
480<DIV>
481<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-n</em>
482 <EM CLASS="Replaceable">NetBIOS_name</em>
483</h4>
484<P CLASS="ListSimple">Allows you to override the NetBIOS name by which the program will advertise itself. </p>
485<DIV>
486<H4 CLASS="HeadC">Smbclient operations</h4>
487<P CLASS="Body">Running <EM CLASS="Literal">smbclient</em><EM CLASS="Literal">//</em><EM CLASS="Replaceable">server_name</em><EM CLASS="Literal">/</em><EM CLASS="Replaceable">share</em>
488 will cause it to prompt you for a username and password. If the login is successful, it will connect to the share and give you a prompt much like an FTP prompt (the backslash in the prompt will be replaced by the current directory within the share as you move around the filesystem):</p>
489<P CLASS="Code">smb:&#92;&gt;</p>
490<P CLASS="Body">From this command line, you can use several FTP-like commands, as listed below. Arguments in square brackets are optional. </p>
491<TABLE>
492<CAPTION>
493<H4 CLASS="TableLabel"><A NAME="89417"></a>&nbsp;</h4>
494<H4 CLASS="TableTitle">smbclient Commands </h4>
495</caption>
496<TR>
497<TH ROWSPAN="1" COLSPAN="1">
498<P CLASS="CellHeading">Command</p>
499</th>
500<TH ROWSPAN="1" COLSPAN="1">
501<P CLASS="CellHeading">Description</p>
502</th>
503</tr>
504<TR>
505<TD ROWSPAN="1" COLSPAN="1">
506<P CLASS="CellBody"><EM CLASS="Literal">?</em>
507 <EM CLASS="Replaceable">command</em>
508</p>
509</td>
510<TD ROWSPAN="1" COLSPAN="1">
511<P CLASS="CellBody">Provides list of commands or help on specified command.</p>
512</td>
513</tr>
514<TR>
515<TD ROWSPAN="1" COLSPAN="1">
516<P CLASS="CellBody"><EM CLASS="Literal">help</em>
517 [<EM CLASS="Replaceable">command</em>]</p>
518</td>
519<TD ROWSPAN="1" COLSPAN="1">
520<P CLASS="CellBody">Provides list of commands or help on specified command.</p>
521</td>
522</tr>
523<TR>
524<TD ROWSPAN="1" COLSPAN="1">
525<P CLASS="CellBody"><EM CLASS="Literal">!</em>
526 [<EM CLASS="Replaceable">command</em>]</p>
527</td>
528<TD ROWSPAN="1" COLSPAN="1">
529<P CLASS="CellBody">If a command is specified, it will be run in a local shell. If not, you will be placed into a local shell on the client.</p>
530</td>
531</tr>
532<TR>
533<TD ROWSPAN="1" COLSPAN="1">
534<P CLASS="CellBody"><EM CLASS="Literal">dir</em>
535 [<EM CLASS="Replaceable">filename</em>]</p>
536</td>
537<TD ROWSPAN="1" COLSPAN="1">
538<P CLASS="CellBody">Displays any files matching <EM CLASS="Replaceable">filename</em>
539 in the current directory on the server, or all files if <EM CLASS="Replaceable">filename</em>
540 is omitted.</p>
541</td>
542</tr>
543<TR>
544<TD ROWSPAN="1" COLSPAN="1">
545<P CLASS="CellBody"><EM CLASS="Literal">ls</em>
546 [<EM CLASS="Replaceable">filename</em>]</p>
547</td>
548<TD ROWSPAN="1" COLSPAN="1">
549<P CLASS="CellBody">Displays any files matching <EM CLASS="Replaceable">filename</em>
550 in the current directory on the server, or all files if <EM CLASS="Replaceable">filename</em>
551 is omitted.</p>
552</td>
553</tr>
554<TR>
555<TD ROWSPAN="1" COLSPAN="1">
556<P CLASS="CellBody"><EM CLASS="Literal">cd</em>
557 [<EM CLASS="Replaceable">directory</em>]</p>
558</td>
559<TD ROWSPAN="1" COLSPAN="1">
560<P CLASS="CellBody">If <EM CLASS="Replaceable">directory</em>
561 is specified, changes to the specified directory on the remote server. If not, reports the current directory on the remote machine.</p>
562</td>
563</tr>
564<TR>
565<TD ROWSPAN="1" COLSPAN="1">
566<P CLASS="CellBody"><EM CLASS="Literal">lcd</em>
567 [<EM CLASS="Replaceable">directory</em>]</p>
568</td>
569<TD ROWSPAN="1" COLSPAN="1">
570<P CLASS="CellBody">If <EM CLASS="Replaceable">directory</em>
571 is specified, the current directory on the local machine will be changed. If not, the name of the current directory on the local machine will be reported.</p>
572</td>
573</tr>
574<TR>
575<TD ROWSPAN="1" COLSPAN="1">
576<P CLASS="CellBody"><EM CLASS="Literal">get</em>
577 <EM CLASS="Emphasis">remotefile </em>
578[<EM CLASS="Replaceable">localfile</em>]</p>
579</td>
580<TD ROWSPAN="1" COLSPAN="1">
581<P CLASS="CellBody">Copies the file <EM CLASS="Replaceable">remotefile</em> to the local machine. If a <EM CLASS="Replaceable">localfile</em>
582 is specified, uses that name to copy the file to. Treats the file as binary; does <EM CLASS="Emphasis">not</em>
583 do LF to CR/LF conversions.</p>
584</td>
585</tr>
586<TR>
587<TD ROWSPAN="1" COLSPAN="1">
588<P CLASS="CellBody"><EM CLASS="Literal">put</em>
589 <EM CLASS="Emphasis">localfile </em>
590[<EM CLASS="Replaceable">remotefile</em>]</p>
591</td>
592<TD ROWSPAN="1" COLSPAN="1">
593<P CLASS="CellBody">Copies <EM CLASS="Replaceable">localfile</em>
594 to the remote machine. If a <EM CLASS="Replaceable">remotefile</em>
595 is specified, uses that as the name to copy to on the remote server. Treats the file as binary; does <EM CLASS="Emphasis">not</em>
596 do LF to CR/LF conversions.</p>
597</td>
598</tr>
599<TR>
600<TD ROWSPAN="1" COLSPAN="1">
601<P CLASS="CellBody"><EM CLASS="Literal">mget</em>
602 <EM CLASS="Replaceable">pattern</em>
603</p>
604</td>
605<TD ROWSPAN="1" COLSPAN="1">
606<P CLASS="CellBody">Gets all files matching <EM CLASS="Replaceable">pattern</em>
607 from the remote machine.</p>
608</td>
609</tr>
610<TR>
611<TD ROWSPAN="1" COLSPAN="1">
612<P CLASS="CellBody"><EM CLASS="Literal">mput</em>
613<EM CLASS="Replaceable"> pattern</em>
614</p>
615</td>
616<TD ROWSPAN="1" COLSPAN="1">
617<P CLASS="CellBody">Places all local files matching <EM CLASS="Replaceable">pattern</em>
618 on the remote machine.</p>
619</td>
620</tr>
621<TR>
622<TD ROWSPAN="1" COLSPAN="1">
623<P CLASS="CellBody"><EM CLASS="Literal">prompt</em>
624</p>
625</td>
626<TD ROWSPAN="1" COLSPAN="1">
627<P CLASS="CellBody">Toggles interactive prompting on and off for <EM CLASS="Literal">mget</em> and <EM CLASS="Literal">mput</em>.</p>
628</td>
629</tr>
630<TR>
631<TD ROWSPAN="1" COLSPAN="1">
632<P CLASS="CellBody"><EM CLASS="Literal">lowercase ON </em>
633 <br>
634
635(or<EM CLASS="Literal"> OFF</em>)</p>
636</td>
637<TD ROWSPAN="1" COLSPAN="1">
638<P CLASS="CellBody">If lowercase is on, <EM CLASS="Emphasis">smbclient</em>
639 will convert filenames to lowercase during an <EM CLASS="Literal">mget</em>
640 or <EM CLASS="Literal">get</em>
641 (but not a <EM CLASS="Literal">mput</em> or <EM CLASS="Literal">put</em>).</p>
642</td>
643</tr>
644<TR>
645<TD ROWSPAN="1" COLSPAN="1">
646<P CLASS="CellBody"><EM CLASS="Literal">del</em>
647 <EM CLASS="Replaceable">filename</em>
648</p>
649</td>
650<TD ROWSPAN="1" COLSPAN="1">
651<P CLASS="CellBody">Delete a file on the remote machine.</p>
652</td>
653</tr>
654<TR>
655<TD ROWSPAN="1" COLSPAN="1">
656<P CLASS="CellBody"><EM CLASS="Literal">md</em>
657 <EM CLASS="Replaceable">directory</em>
658</p>
659</td>
660<TD ROWSPAN="1" COLSPAN="1">
661<P CLASS="CellBody">Create a directory on the remote machine.</p>
662</td>
663</tr>
664<TR>
665<TD ROWSPAN="1" COLSPAN="1">
666<P CLASS="CellBody"><EM CLASS="Literal">mkdir</em>
667 <EM CLASS="Replaceable">directory</em>
668</p>
669</td>
670<TD ROWSPAN="1" COLSPAN="1">
671<P CLASS="CellBody">Create a directory on the remote machine.</p>
672</td>
673</tr>
674<TR>
675<TD ROWSPAN="1" COLSPAN="1">
676<P CLASS="CellBody"><EM CLASS="Literal">rd</em>
677 <EM CLASS="Replaceable">directory</em>
678</p>
679</td>
680<TD ROWSPAN="1" COLSPAN="1">
681<P CLASS="CellBody">Remove the specified directory on the remote machine.</p>
682</td>
683</tr>
684<TR>
685<TD ROWSPAN="1" COLSPAN="1">
686<P CLASS="CellBody"><EM CLASS="Literal">rmdir</em>
687 <EM CLASS="Replaceable">directory</em>
688</p>
689</td>
690<TD ROWSPAN="1" COLSPAN="1">
691<P CLASS="CellBody">Remove the specified directory on the remote machine.</p>
692</td>
693</tr>
694<TR>
695<TD ROWSPAN="1" COLSPAN="1">
696<P CLASS="CellBody"><EM CLASS="Literal">setmode</em>
697 <EM CLASS="Replaceable">filename</em>
698 <EM CLASS="Literal">[+|-]rsha</em>
699</p>
700</td>
701<TD ROWSPAN="1" COLSPAN="1">
702<P CLASS="CellBody">Set DOS filesystem attribute bits, using Unix-like modes. <EM CLASS="Literal">r</em>
703 is read-only, <EM CLASS="Literal">s</em>
704 is system, <EM CLASS="Literal">h</em>
705 is hidden, and <EM CLASS="Literal">a</em>
706 is archive.</p>
707</td>
708</tr>
709<TR>
710<TD ROWSPAN="1" COLSPAN="1">
711<P CLASS="CellBody"><EM CLASS="Literal">exit</em>
712</p>
713</td>
714<TD ROWSPAN="1" COLSPAN="1">
715<P CLASS="CellBody">Exits <EM CLASS="Emphasis">smbclient</em>.</p>
716</td>
717</tr>
718<TR>
719<TD ROWSPAN="1" COLSPAN="1">
720<P CLASS="CellBody"><EM CLASS="Literal">quit</em>
721</p>
722</td>
723<TD ROWSPAN="1" COLSPAN="1">
724<P CLASS="CellBody">Exits <EM CLASS="Emphasis">smbclient</em>.</p>
725</td>
726</tr>
727</table>
728<P CLASS="Body">There are also mask and recursive commands for large copies; see the <EM CLASS="Filename">smbclient</em>
729 manual page for details on how to use these. With the exception of mask, recursive, and the lack of an ASCII transfer mode, <EM CLASS="Emphasis">smbclient</em>
730 works exactly the same as FTP. Note that because it does binary transfers, Windows files copied to Unix will have lines ending in carriage-return and linefeed (<EM CLASS="Literal">&#92;r&#92;n</em>), not Unix's linefeed (<EM CLASS="Literal">&#92;n</em>).</p>
731</div>
732<DIV>
733<H4 CLASS="HeadC">Printing commands</h4>
734<P CLASS="Body">The <EM CLASS="Emphasis">smbclient</em>
735 program can also be used for access to a printer by connecting to a print share. Once connected, the commands shown below can be used to print. </p>
736<TABLE>
737<CAPTION>
738<H4 CLASS="TableLabel"><A NAME="39300"></a>&nbsp;</h4>
739<H4 CLASS="TableTitle">smbclient Printing Commands </h4>
740</caption>
741<TR>
742<TH ROWSPAN="1" COLSPAN="1">
743<P CLASS="CellHeading">Command</p>
744</th>
745<TH ROWSPAN="1" COLSPAN="1">
746<P CLASS="CellHeading">Description</p>
747</th>
748</tr>
749<TR>
750<TD ROWSPAN="1" COLSPAN="1">
751<P CLASS="CellBody"><EM CLASS="Literal">print</em>
752<EM CLASS="Replaceable"> filename</em>
753</p>
754</td>
755<TD ROWSPAN="1" COLSPAN="1">
756<P CLASS="CellBody">Prints the file by copying it from the local machine to the remote one and then submitting it as a print job there.</p>
757</td>
758</tr>
759<TR>
760<TD ROWSPAN="1" COLSPAN="1">
761<P CLASS="CellBody"><EM CLASS="Literal">printmode</em>
762 <EM CLASS="Replaceable">text </em>
763|<EM CLASS="Replaceable"> graphics</em>
764</p>
765</td>
766<TD ROWSPAN="1" COLSPAN="1">
767<P CLASS="CellBody">Instructs the server that the following files will be plain text (ASCII) or the binary graphics format that the printer requires. It's up to the user to ensure that the file is indeed the right kind.</p>
768</td>
769</tr>
770<TR>
771<TD ROWSPAN="1" COLSPAN="1">
772<P CLASS="CellBody"><EM CLASS="Literal">queue</em>
773</p>
774</td>
775<TD ROWSPAN="1" COLSPAN="1">
776<P CLASS="CellBody">Displays the queue for the print share you're connected to, showing job ID, name, size, and status.</p>
777</td>
778</tr>
779</table>
780</div>
781</div>
782<DIV>
783<H4 CLASS="SidebarBody">Finally, to print from the <EM CLASS="Emphasis">smbclient</em>, use the <EM CLASS="Literal">-c</em>
784 option:</h4>
785<P CLASS="Code">cat <EM CLASS="Replaceable">printfile</em>
786 | smbclient //<EM CLASS="Replaceable">server</em>
787/<EM CLASS="Replaceable">printer_name</em>
788  -c &quot;print -&quot;</p>
789<DIV>
790<H4 CLASS="HeadC">Tar commands</h4>
791<P CLASS="Body"><EM CLASS="Emphasis">smbclient</em>
792 can tar up files from a file share. This is normally done from the command line using the <EM CLASS="Emphasis">smbtar</em>
793 command, but the commands shown below are also available interactively. </p>
794<TABLE>
795<CAPTION>
796<H4 CLASS="TableLabel"><A NAME="54517"></a>&nbsp;</h4>
797<H4 CLASS="TableTitle">smbclient Tar Commands </h4>
798</caption>
799<TR>
800<TH ROWSPAN="1" COLSPAN="1">
801<P CLASS="CellHeading">Command</p>
802</th>
803<TH ROWSPAN="1" COLSPAN="1">
804<P CLASS="CellHeading">Description</p>
805</th>
806</tr>
807<TR>
808<TD ROWSPAN="1" COLSPAN="1">
809<P CLASS="CellBody"><EM CLASS="Literal">tar c|x[IXbgNa]</em>
810 <EM CLASS="Replaceable">operands</em>
811</p>
812</td>
813<TD ROWSPAN="1" COLSPAN="1">
814<P CLASS="CellBody">Performs a creation or extraction <EM CLASS="Emphasis">tar</em> similar to the command-line program. </p>
815</td>
816</tr>
817<TR>
818<TD ROWSPAN="1" COLSPAN="1">
819<P CLASS="CellBody"><EM CLASS="Literal">blocksize</em>
820 <EM CLASS="Replaceable">size</em>
821</p>
822</td>
823<TD ROWSPAN="1" COLSPAN="1">
824<P CLASS="CellBody">Sets the block size to be used by <EM CLASS="Emphasis">tar</em>, in 512-byte blocks.</p>
825</td>
826</tr>
827<TR>
828<TD ROWSPAN="1" COLSPAN="1">
829<P CLASS="CellBody"><EM CLASS="Literal">tarmode full|inc|reset|<br>
830
831noreset</em>
832</p>
833</td>
834<TD ROWSPAN="1" COLSPAN="1">
835<P CLASS="CellBody">Makes <EM CLASS="Emphasis">tar</em>
836 pay attention to DOS archive bit for all following commands. In <EM CLASS="Literal">full</em>
837 mode (the default), <EM CLASS="Emphasis">tar</em>
838 will back up everything. In <EM CLASS="Literal">inc</em>
839 (incremental) mode, <EM CLASS="Emphasis">tar</em>
840 will back up only those files with the archive bit set. In <EM CLASS="Literal">reset</em>
841 mode, <EM CLASS="Emphasis">tar</em>
842 will reset the archive bit on all files it backs up (this requires the share to be writable), and in <EM CLASS="Literal">noreset</em>
843 mode the archive bit will not be reset even after the file has been backed up.</p>
844</td>
845</tr>
846</table>
847</div>
848<DIV>
849<H4 CLASS="HeadC">Command-line message program options</h4>
850</div>
851</div>
852<DIV>
853<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-M</em>
854 <EM CLASS="Replaceable">NetBIOS_machine_name</em>
855</h4>
856<UL>
857<LI CLASS="ListVariable">This option allows you to send immediate messages using the WinPopup protocol to another computer. Once a connection is established, you can type your message, pressing control-D to end. If WinPopup is not running on the receiving machine, the program returns an error.</li>
858</ul>
859</div>
860<DIV>
861<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-U</em>
862 <EM CLASS="Replaceable">user</em>
863 </h4>
864<UL>
865<LI CLASS="ListVariable">This<EM CLASS="Replaceable"> </em>
866option allows you to indirectly control the FROM part of the message. </li>
867</ul>
868<DIV>
869<H4 CLASS="HeadC">Command-line tar program options</h4>
870<P CLASS="Body">The <EM CLASS="Literal">-T</em>
871 (tar), <EM CLASS="Literal">-D</em>
872 (starting directory), and <EM CLASS="Literal">-c</em>
873 (command) options are used together to tar up files interactively. This is better done with <EM CLASS="Filename">smbtar</em>, which will be discussed shortly. We don't recommend using <EM CLASS="Emphasis">smbclient</em>
874 directly as a <EM CLASS="Emphasis">tar</em>
875 program. </p>
876</div>
877</div>
878<DIV>
879<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-D</em>
880 <EM CLASS="Replaceable">initial_directory</em>
881</h4>
882<UL>
883<LI CLASS="ListVariable">Changes to initial directory before starting.</li>
884</ul>
885</div>
886<DIV>
887<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-c</em>
888 <EM CLASS="Replaceable">command_string</em>
889 </h4>
890<UL>
891<LI CLASS="ListVariable">Passes a command string to the <EM CLASS="Emphasis">smbclient</em>
892 command interpreter, which treats it as a semicolon-separated list of commands to be executed. This is handy to say things such as <EM CLASS="Literal">tarmode</em> <EM CLASS="Literal">inc</em>, for example, which forces <EM CLASS="Literal">smbclient</em>
893 <EM CLASS="Literal">-T</em>
894 to back up only files with the archive bit set.</li>
895</ul>
896</div>
897<DIV>
898<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-T</em>
899 <EM CLASS="Replaceable">command filename</em>
900</h4>
901<UL>
902<LI CLASS="ListVariable">Runs the <EM CLASS="Emphasis">tar</em>
903 driver, which is <EM CLASS="Emphasis">gtar</em>
904 compatible. The two main commands are: <EM CLASS="Literal">c</em>
905 (create) and <EM CLASS="Literal">x</em>
906 (extract), which may be followed by any of:</li>
907</ul>
908<DIV>
909<H4 CLASS="FM-ListVariableTermRunin"><EM CLASS="Literal">a</em>
910</h4>
911<P CLASS="FM-ListVariable">Resets archive bits once files are saved.</p>
912</div>
913<DIV>
914<H5 CLASS="FM-ListVariableTerm"><EM CLASS="Literal">b</em>
915 <EM CLASS="Replaceable">size</em>
916</h5>
917<P CLASS="FM-ListVariable">Sets blocksize in 512-byte units.</p>
918<DIV>
919<H4 CLASS="FM-ListVariableTermRunin"><EM CLASS="Literal">g</em>
920</h4>
921<P CLASS="FM-ListVariable">Backs up only files with the archive bit set.</p>
922</div>
923</div>
924<DIV>
925<H5 CLASS="FM-ListVariableTerm"><EM CLASS="Literal">I</em>
926 <EM CLASS="Replaceable">file</em>
927</h5>
928<P CLASS="FM-ListVariable">Includes files and directories (this is the default). Does not do pattern-matching.</p>
929</div>
930<DIV>
931<H5 CLASS="FM-ListVariableTerm"><EM CLASS="Literal">N</em>
932 <EM CLASS="Replaceable">filename</em>
933</h5>
934<P CLASS="FM-ListVariable">Backs up only those files newer than <EM CLASS="Replaceable">filename.</em>
935</p>
936<DIV>
937<H4 CLASS="FM-ListVariableTermRunin"><EM CLASS="Literal">q</em>
938</h4>
939<P CLASS="FM-ListVariable">Does not produce diagnostics.</p>
940</div>
941</div>
942<DIV>
943<H5 CLASS="FM-ListVariableTerm"><EM CLASS="Literal">X</em>
944 <EM CLASS="Replaceable">file</em>
945</h5>
946<P CLASS="FM-ListVariable">Excludes files.</p>
947<DIV>
948<H4 CLASS="HeadC">Command-line query program</h4>
949<P CLASS="Body">If <EM CLASS="Filename">smbclient</em>
950 is run as:</p>
951<P CLASS="Code">smbclient -L <EM CLASS="Replaceable">server_name</em>
952</p>
953<P CLASS="Body">it will list the shares and other services that machine provides. This is handy if you don't have <EM CLASS="Filename">smbwrappers</em>. It can also be helpful as a testing program in its own right.</p>
954</div>
955<DIV>
956<H4 CLASS="HeadC">Command-line debugging /diagnostic program options</h4>
957<P CLASS="Body">Any of the various modes of operation of <EM CLASS="Emphasis">smbclient</em>
958 can be used with the debugging and testing command-line options:</p>
959</div>
960</div>
961</div>
962<DIV>
963<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-B</em>
964 <EM CLASS="Replaceable">IP_addr</em>
965</h4>
966<UL>
967<LI CLASS="ListVariable">Sets the broadcast address.</li>
968</ul>
969</div>
970<DIV>
971<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-d</em>
972 <EM CLASS="Replaceable">debug_level</em>
973</h4>
974<UL>
975<LI CLASS="ListVariable">Sets the debug (sometimes called logging) level. The level can range from 0 all the way to 10. In addition, you can specify <EM CLASS="Literal">A</em>
976 for all debugging options. Debug level 0 logs only the most important messages; level 1 is normal; level 3 and above are primarily for debugging and slow operations considerably.</li>
977</ul>
978<DIV>
979<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-E</em>
980</h4>
981<UL>
982<LI CLASS="ListVariable">Sends all messages to stderr instead of stdout.</li>
983</ul>
984</div>
985</div>
986<DIV>
987<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-I</em>
988 <EM CLASS="Replaceable">IP_address</em>
989 </h4>
990<UL>
991<LI CLASS="ListVariable">Sets the IP address of the server to which it connects.</li>
992</ul>
993</div>
994<DIV>
995<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-i</em>
996 <EM CLASS="Replaceable">scope</em>
997</h4>
998<UL>
999<LI CLASS="ListVariable">This sets a NetBIOS scope identifier. Only machines with the same identifier will communicate with the server. The scope identifier was a predecessor to workgroups, and this option is included only for backward compatibility.</li>
1000</ul>
1001</div>
1002<DIV>
1003<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-l</em>
1004 <EM CLASS="Replaceable">log_file</em>
1005</h4>
1006<UL>
1007<LI CLASS="ListVariable">Sends the log messages to the specified file. </li>
1008</ul>
1009<DIV>
1010<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-N</em>
1011</h4>
1012<UL>
1013<LI CLASS="ListVariable">Suppresses the password prompt. Unless a password is specified on the command line or this parameter is specified, the client will prompt for a password.</li>
1014</ul>
1015</div>
1016</div>
1017<DIV>
1018<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-n</em>
1019 <EM CLASS="Replaceable">NetBIOS_name</em>
1020</h4>
1021<P CLASS="ListSimple">This option allows you to override the NetBIOS name by which the daemon will advertise itself. </p>
1022</div>
1023<DIV>
1024<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-O</em>
1025 <EM CLASS="Replaceable">socket_options</em>
1026</h4>
1027<UL>
1028<LI CLASS="ListVariable">Sets the TCP/IP socket options using the same parameters as the <EM CLASS="Literal">socket</em>
1029 <EM CLASS="Literal">options</em>
1030 configuration option. It is often used for performance tuning and testing.</li>
1031</ul>
1032</div>
1033<DIV>
1034<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-p</em>
1035 <EM CLASS="Replaceable">port_number</em>
1036</h4>
1037<UL>
1038<LI CLASS="ListVariable">Sets the port number from which the client will accept requests.  </li>
1039</ul>
1040</div>
1041<DIV>
1042<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-R</em>
1043 <EM CLASS="Replaceable">resolve_order</em>
1044</h4>
1045<UL>
1046<LI CLASS="ListVariable">Sets the resolve order of the name servers. This option is similar to the <EM CLASS="Literal">resolve</em>
1047 <EM CLASS="Literal">order</em>
1048 configuration option, and can take any of the four parameters, <EM CLASS="Literal">lmhosts</em>, <EM CLASS="Literal">host</em>, <EM CLASS="Literal">wins</em>, and <EM CLASS="Literal">bcast</em>, in any order.</li>
1049</ul>
1050</div>
1051<DIV>
1052<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-s</em>
1053 <EM CLASS="Replaceable">configuration_file</em>
1054</h4>
1055<UL>
1056<LI CLASS="ListVariable">Specifies the location of the Samba configuration file. Used for debugging.</li>
1057</ul>
1058</div>
1059<DIV>
1060<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-t</em>
1061 <EM CLASS="Replaceable">terminal_code</em>
1062</h4>
1063<UL>
1064<LI CLASS="ListVariable">Sets the terminal code for Asian languages.</li>
1065</ul>
1066</div>
1067<DIV>
1068<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-U</em>
1069 <EM CLASS="Replaceable">username</em>
1070</h4>
1071<UL>
1072<LI CLASS="ListVariable">Sets the username and optionally password (e.g., <EM CLASS="Literal">-U</em>
1073 <EM CLASS="Literal">fred%secret</em>).</li>
1074</ul>
1075</div>
1076<DIV>
1077<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-W</em>
1078 <EM CLASS="Replaceable">workgroup</em>
1079</h4>
1080<UL>
1081<LI CLASS="ListVariable">Specifies the workgroup that you want the client to connect as.</li>
1082</ul>
1083<P CLASS="Body">If you want to test a particular name service, run <EM CLASS="Emphasis">smbclient</em>
1084 with <EM CLASS="Literal">-R</em>
1085 and just the name of the service. This will force <EM CLASS="Emphasis">smbclient</em>
1086 to use only the service you gave.<EM CLASS="Emphasis"></em>
1087</p>
1088</div>
1089</div>
1090<DIV>
1091<H3 CLASS="HeadB">smbstatus</h3>
1092<P CLASS="Body">The <EM CLASS="Filename">smbstatus</em>
1093 program lists the current connections on a Samba server. There are three separate sections. The first section lists various shares that are in use by specific users. The second section lists the locked files that Samba currently has on all of its shares. Finally, the third section lists the amount of memory usage for each of the shares. For example:</p>
1094<pre>
1095# <EM CLASS="LineEmphasis">smbstatus</em>
1096
1097Samba version 2.0.3
1098Service      uid      gid      pid     machine
1099----------------------------------------------
1100network      davecb   davecb   7470   phoenix  (192.168.220.101) Sun May 16 
1101network      davecb   davecb   7589   chimaera (192.168.220.102) Sun May 16 
1102&nbsp;
1103Locked files:
1104Pid    DenyMode   R/W        Oplock           Name
1105--------------------------------------------------
11067589   DENY_NONE  RDONLY   EXCLUSIVE+BATCH  /home/samba/quicken/inet/common/system/help.bmp   Sun May 16 21:23:40 1999
11077470   DENY_WRITE RDONLY   NONE             /home/samba/word/office/findfast.exe              Sun May 16 20:51:08 1999
11087589   DENY_WRITE RDONLY   EXCLUSIVE+BATCH  /home/samba/quicken/lfbmp70n.dll                  Sun May 16 21:23:39 1999
11097589   DENY_WRITE RDWR     EXCLUSIVE+BATCH  /home/samba/quicken/inet/qdata/runtime.dat        Sun May 16 21:23:41 1999
11107470   DENY_WRITE RDONLY   EXCLUSIVE+BATCH  /home/samba/word/office/osa.exe                   Sun May 16 20:51:09 1999
11117589   DENY_WRITE RDONLY   NONE             /home/samba/quicken/qversion.dll                  Sun May 16 21:20:33 1999
11127470   DENY_WRITE RDONLY   NONE             /home/samba/quicken/qversion.dll                  Sun May 16 20:51:11 1999
1113&nbsp;
1114Share mode memory usage (bytes):
1115   1043432(99%) free + 4312(0%) used + 832(0%) overhead = 1048576(100%) total
1116</pre>
1117<DIV>
1118<H4 CLASS="HeadC">Options</h4>
1119</div>
1120<DIV>
1121<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-b</em>
1122</h4>
1123<UL>
1124<LI CLASS="ListVariable">Forces <EM CLASS="Filename">smbstatus</em>
1125 to produce brief output. This includes the version of Samba and auditing information about the users that have logged into the server.</li>
1126</ul>
1127</div>
1128<DIV>
1129<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-d</em>
1130</h4>
1131<UL>
1132<LI CLASS="ListVariable">Gives verbose output, including each of the three reporting sections listed in the previous example. This is the default.</li>
1133</ul>
1134</div>
1135<DIV>
1136<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-L</em>
1137</h4>
1138<UL>
1139<LI CLASS="ListVariable">Forces <EM CLASS="Filename">smbstatus</em>
1140 to print only the current file locks it has. This corresponds to the second section in a verbose output. </li>
1141</ul>
1142</div>
1143<DIV>
1144<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-p</em>
1145</h4>
1146<UL>
1147<LI CLASS="ListVariable">Prints a list of <EM CLASS="Filename">smbd</em>
1148 process IDs only. This is often used for scripts.</li>
1149</ul>
1150</div>
1151<DIV>
1152<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-S</em>
1153</h4>
1154<UL>
1155<LI CLASS="ListVariable">Prints only a list of shares and their connections. This corresponds to the first section in a verbose output.</li>
1156</ul>
1157</div>
1158<DIV>
1159<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-s</em>
1160 <EM CLASS="Replaceable">configuration_file</em>
1161</h4>
1162<UL>
1163<LI CLASS="ListVariable">Sets the Samba configuration file to use when processing this command.</li>
1164</ul>
1165</div>
1166<DIV>
1167<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-u</em>
1168 <EM CLASS="Replaceable">username</em>
1169</h4>
1170<UL>
1171<LI CLASS="ListVariable">Limits the <EM CLASS="Filename">smbstatus</em>
1172 report to the activity of a single user.</li>
1173</ul>
1174</div>
1175</div>
1176<DIV>
1177<H3 CLASS="HeadB">smbtar</h3>
1178<P CLASS="Body">The <EM CLASS="Emphasis">smbtar</em>
1179 program is a shell script on top of <EM CLASS="Emphasis">smbclient</em>
1180 that gives the program more intelligible options when doing tar operations. Functionally, it is equivalent to the Unix <EM CLASS="Emphasis">tar</em>
1181 program.</p>
1182<DIV>
1183<H4 CLASS="HeadC">Options</h4>
1184</div>
1185<DIV>
1186<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-a</em>
1187</h4>
1188<UL>
1189<LI CLASS="ListVariable">Resets the archive bit mode</li>
1190</ul>
1191</div>
1192<DIV>
1193<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-b</em>
1194 <EM CLASS="Replaceable">blocksize</em>
1195</h4>
1196<UL>
1197<LI CLASS="ListVariable">Blocking size. Defaults to 20.</li>
1198</ul>
1199</div>
1200<DIV>
1201<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-d</em>
1202 <EM CLASS="Replaceable">directory</em>
1203</h4>
1204<UL>
1205<LI CLASS="ListVariable">Changes to initial directory before restoring or backing up files.</li>
1206</ul>
1207<DIV>
1208<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-i</em>
1209</h4>
1210<UL>
1211<LI CLASS="ListVariable">Incremental mode; tar files are backed up only if they have the DOS archive bit set. The archive bit is reset after each file is read.</li>
1212</ul>
1213</div>
1214</div>
1215<DIV>
1216<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-l</em>
1217 <EM CLASS="Replaceable">log_level</em>
1218</h4>
1219<UL>
1220<LI CLASS="ListVariable"> Sets the logging level.</li>
1221</ul>
1222</div>
1223<DIV>
1224<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-N</em>
1225 <EM CLASS="Replaceable">filename</em>
1226</h4>
1227<UL>
1228<LI CLASS="ListVariable">Backs up only the files newer than the last modification date of <EM CLASS="Replaceable">filename</em>. For incremental backups.</li>
1229</ul>
1230</div>
1231<DIV>
1232<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-p</em>
1233 <EM CLASS="Replaceable">password</em>
1234</h4>
1235<UL>
1236<LI CLASS="ListVariable">Specifies the password to use to access a share.</li>
1237</ul>
1238<DIV>
1239<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-r</em>
1240</h4>
1241<UL>
1242<LI CLASS="ListVariable">Restores files to the share from the tar file.</li>
1243</ul>
1244</div>
1245</div>
1246<DIV>
1247<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-s</em>
1248 <EM CLASS="Replaceable">server</em>
1249</h4>
1250<UL>
1251<LI CLASS="ListVariable">Specifies the SMB/CIFS server in which the share resides.</li>
1252</ul>
1253</div>
1254<DIV>
1255<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-t</em>
1256 <EM CLASS="Replaceable">tape</em>
1257</h4>
1258<UL>
1259<LI CLASS="ListVariable">Tape device or file. Default is the value of the environment variable <EM CLASS="Literal">$TAPE</em>, or <EM CLASS="Emphasis">tar.out</em>
1260 if <EM CLASS="Literal">$TAPE</em>
1261 isn't set.</li>
1262</ul>
1263</div>
1264<DIV>
1265<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-u</em>
1266 <EM CLASS="Replaceable">user</em>
1267</h4>
1268<UL>
1269<LI CLASS="ListVariable">Specifies the user to connect to the share as. You can specify the password as well, in the format <EM CLASS="Replaceable">username</em><EM CLASS="Literal">%</em><EM CLASS="Replaceable">password</em>.</li>
1270</ul>
1271<DIV>
1272<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-v</em>
1273</h4>
1274<UL>
1275<LI CLASS="ListVariable">Specifies the use of verbose mode.</li>
1276</ul>
1277</div>
1278</div>
1279<DIV>
1280<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-X</em>
1281 <EM CLASS="Replaceable">file</em>
1282</h4>
1283<UL>
1284<LI CLASS="ListVariable">Tells <EM CLASS="FirstTerm">smbtar</em>
1285 to exclude the specified file from the <EM CLASS="Emphasis">tar</em>
1286 create or restore.</li>
1287</ul>
1288</div>
1289<DIV>
1290<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-x</em>
1291 <EM CLASS="Replaceable">share</em>
1292</h4>
1293<UL>
1294<LI CLASS="ListVariable">States the share name on the server to connect to. The default is <EM CLASS="Literal">backup</em>, which is a common share name to perform backups with.</li>
1295</ul>
1296</div>
1297<DIV>
1298<H4 CLASS="SidebarBody">For example, a trivial backup command to archive the data for user <EM CLASS="Literal">sue</em>
1299 is:</h4>
1300<P CLASS="Code"># <EM CLASS="LineEmphasis">smbtar -s pc_name -x sue -u sue -p secret -t sue.tar </em>
1301</p>
1302</div>
1303</div>
1304<DIV>
1305<H3 CLASS="HeadB">nmblookup</h3>
1306<P CLASS="Body">The <EM CLASS="Filename">nmblookup</em>
1307 program is a client program that exercises the NetBIOS-over-UDP/IP name service for resolving NBT machine names into IP addresses. The command works by broadcasting its queries on the local subnet until a machine with that name responds. You can think of it as a Windows <EM CLASS="Emphasis">nslookup(1) </em>
1308or <EM CLASS="EmailSite">dig(1). </em>
1309This is useful for looking up both normal NetBIOS names, and the odd ones like        <EM CLASS="Literal">__MSBROWSE__</em>
1310 that the Windows name services use to provide directory-like services. If you wish to query for a particular type of NetBIOS name, add the NetBIOS <EM CLASS="Literal">&lt;type&gt;</em>
1311 to the end of the name.</p>
1312<P CLASS="Body">The command line is:</p>
1313<P CLASS="Code">nmblookup [-options] <EM CLASS="Replaceable">name</em>
1314</p>
1315<P CLASS="Body">The options supported are:</p>
1316<DIV>
1317<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-A</em>
1318</h4>
1319<UL>
1320<LI CLASS="ListVariable">Interprets <EM CLASS="Replaceable">name</em>
1321 as an IP address and do a node-status query on this address.</li>
1322</ul>
1323</div>
1324<DIV>
1325<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-B</em>
1326 <EM CLASS="Replaceable">broadcast _address</em>
1327</h4>
1328<UL>
1329<LI CLASS="ListVariable">Sends the query to the given broadcast address. The default is to send the query to the broadcast address of the primary network interface.</li>
1330</ul>
1331</div>
1332<DIV>
1333<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-d</em>
1334 <EM CLASS="Replaceable">debuglevel</em>
1335</h4>
1336<UL>
1337<LI CLASS="ListVariable">Sets the debug (sometimes called logging) level. The level can range from 0 all the way to 10. Debug level 0 logs only the most important messages; level 1 is normal; level 3 and above are primarily for debugging and slow the program considerably.</li>
1338</ul>
1339<DIV>
1340<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-h</em>
1341</h4>
1342<UL>
1343<LI CLASS="ListVariable">Prints command-line usage information for the program.</li>
1344</ul>
1345</div>
1346</div>
1347<DIV>
1348<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-i</em>
1349 <EM CLASS="Replaceable">scope</em>
1350</h4>
1351<UL>
1352<LI CLASS="ListVariable">Sets a NetBIOS scope identifier. Only machines with the same identifier will communicate with the server. The scope identifier was a predecessor to workgroups, and this option is included only for backward compatibility.</li>
1353</ul>
1354<DIV>
1355<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-M</em>
1356</h4>
1357<UL>
1358<LI CLASS="ListVariable">Searches for a local master browser. This is done with a broadcast searching for a machine that will respond to the special name <EM CLASS="Literal">__MSBROWSE__</em>, and then asking that machine for information, instead of broadcasting the query itself.</li>
1359</ul>
1360</div>
1361<DIV>
1362<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-R</em>
1363</h4>
1364<UL>
1365<LI CLASS="ListVariable">Sets the recursion desired bit in the packet. This will cause the machine that responds to try to do a WINS lookup and return the address and any other information the WINS server has saved.</li>
1366</ul>
1367</div>
1368<DIV>
1369<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-r</em>
1370</h4>
1371<UL>
1372<LI CLASS="ListVariable">Use the root port of 137 for Windows 95 machines.</li>
1373</ul>
1374</div>
1375<DIV>
1376<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-S</em>
1377</h4>
1378<UL>
1379<LI CLASS="ListVariable">Once the name query has returned an IP address, does a node status query as well. This returns all the resource types that the machine knows about, with their numeric attributes. For example:</li>
1380</ul>
1381<pre>
1382% <EM CLASS="LineEmphasis">nmblookup -d 4 -S elsbeth</em>
1383received 6 names
1384      ELSBETH                &lt;00&gt; - &lt;GROUP&gt; B &lt;ACTIVE&gt;
1385      ELSBETH                &lt;03&gt; -         B &lt;ACTIVE&gt;
1386      ELSBETH                &lt;1d&gt; -         B &lt;ACTIVE&gt;
1387      ELSBETH                &lt;1e&gt; - &lt;GROUP&gt; B &lt;ACTIVE&gt;
1388      ELSBETH                &lt;20&gt; -         B &lt;ACTIVE&gt;
1389      ..__MSBROWSE__..       &lt;01&gt; - &lt;GROUP&gt; B &lt;ACTIVE&gt;
1390</pre>
1391</div>
1392</div>
1393<DIV>
1394<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-s</em>
1395 <EM CLASS="Replaceable">configuration_file</em>
1396</h4>
1397<UL>
1398<LI CLASS="ListVariable">Specifies the location of the Samba configuration file. Although the file defaults to <EM CLASS="Filename">/usr/local/samba/lib/smb.conf</em>, you can override it here on the command-line, normally for debugging.</li>
1399</ul>
1400<DIV>
1401<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-T</em>
1402</h4>
1403<UL>
1404<LI CLASS="ListVariable">This option can be used to translate IP addresses into resolved names. </li>
1405</ul>
1406</div>
1407</div>
1408<DIV>
1409<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-U</em>
1410 <EM CLASS="Replaceable">unicast_address</em>
1411</h4>
1412<UL>
1413<LI CLASS="ListVariable">Performs a unicast query to the specified address. Used with <EM CLASS="Literal">-R</em>
1414 to query WINS servers.</li>
1415</ul>
1416<P CLASS="Body">Note that there is no workgroup option for <EM CLASS="Emphasis">nmblookup</em>; you can get around this by putting <EM CLASS="Literal">workgroup</em>
1417 <EM CLASS="Literal">=</em>
1418 <EM CLASS="Replaceable">workgroup_name </em>
1419in a file and passing it to <EM CLASS="Emphasis">nmblookup</em>
1420 with the <EM CLASS="Literal">-s</em>
1421 <EM CLASS="Replaceable">smb.conf_file</em>
1422 option. </p>
1423</div>
1424</div>
1425<DIV>
1426<H3 CLASS="HeadB">smbpasswd</h3>
1427<P CLASS="Body">The <EM CLASS="Emphasis">smbpasswd</em>
1428 password has two distinct sets of functions. When run by users, it changes their encrypted passwords. When run by <EM CLASS="Literal">root</em>, it updates the encrypted password file. When run by an ordinary user with no options, it connects to the primary domain controller and changes his or her Windows password.</p>
1429<P CLASS="Body">The program will fail if <EM CLASS="Emphasis">smbd</em>
1430 is not operating, if the <EM CLASS="Literal">hosts</em>
1431 <EM CLASS="Literal">allow</em>
1432 or <EM CLASS="Literal">hosts</em>
1433 <EM CLASS="Literal">deny</em>
1434 configuration options will not permit connections from localhost (IP address 127.0.0.1), or the <EM CLASS="Literal">encrypted</em>
1435 <EM CLASS="Literal">passwords</em>
1436 <EM CLASS="Literal">=</em>
1437 <EM CLASS="Literal">no</em>
1438 option is set.</p>
1439<DIV>
1440<H4 CLASS="HeadC">Regular user options</h4>
1441</div>
1442<DIV>
1443<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-D</em>
1444 <EM CLASS="Replaceable">debug_level</em>
1445</h4>
1446<UL>
1447<LI CLASS="ListVariable">Sets the debug (also called logging) level. The level can range from 0 to 10. Debug level 0 logs only the most important messages; level 1 is normal; level 3 and above are primarily for debugging and slow the program considerably.</li>
1448</ul>
1449<DIV>
1450<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-h</em>
1451</h4>
1452<UL>
1453<LI CLASS="ListVariable">Prints command-line usage information for the program.</li>
1454</ul>
1455</div>
1456</div>
1457<DIV>
1458<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-r</em>
1459 <EM CLASS="Replaceable">remote_machine_name</em>
1460</h4>
1461<UL>
1462<LI CLASS="ListVariable">Specifies on which machine the password should change. The remote machine must be a primary domain controller (PDC).</li>
1463</ul>
1464</div>
1465<DIV>
1466<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-R</em>
1467 <EM CLASS="Replaceable">resolve_order</em>
1468</h4>
1469<UL>
1470<LI CLASS="ListVariable">Sets the resolve order of the name servers. This option is similar to the <EM CLASS="Literal">resolve</em>
1471 <EM CLASS="Literal">order</em>
1472 configuration option, and can take any of the four parameters, <EM CLASS="Literal">lmhosts</em>, <EM CLASS="Literal">host</em>, <EM CLASS="Literal">wins</em>, and <EM CLASS="Literal">bcast</em>,<EM CLASS="Literal"> </em> in any order.</li>
1473</ul>
1474</div>
1475<DIV>
1476<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-U</em>
1477 <EM CLASS="Replaceable">username</em>
1478</h4>
1479<UL>
1480<LI CLASS="ListVariable">Used only with <EM CLASS="Literal">-r</em>, to modify a username that is spelled differently on the remote machine.</li>
1481</ul>
1482<DIV>
1483<H4 CLASS="HeadC">Root-only options</h4>
1484</div>
1485</div>
1486<DIV>
1487<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-a</em>
1488 <EM CLASS="Replaceable">username</em>
1489</h4>
1490<UL>
1491<LI CLASS="ListVariable">Adds a user to the encrypted password file.</li>
1492</ul>
1493</div>
1494<DIV>
1495<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-d</em>
1496 <EM CLASS="Replaceable">username</em>
1497</h4>
1498<UL>
1499<LI CLASS="ListVariable">Disables a user in the encrypted password file.</li>
1500</ul>
1501</div>
1502<DIV>
1503<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-e</em>
1504 <EM CLASS="Replaceable">username</em>
1505</h4>
1506<UL>
1507<LI CLASS="ListVariable">Enables a disabled user in the encrypted password file.</li>
1508</ul>
1509</div>
1510<DIV>
1511<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-m</em>
1512 <EM CLASS="Replaceable">machine_name</em>
1513</h4>
1514<UL>
1515<LI CLASS="ListVariable">Changes a machine account's password. The machine accounts are used to authenticate machines when they connect to a primary or backup domain controller.</li>
1516</ul>
1517</div>
1518<DIV>
1519<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-j</em>
1520 <EM CLASS="Replaceable">domain_name</em>
1521</h4>
1522<UL>
1523<LI CLASS="ListVariable">Adds a Samba server to a Windows NT Domain.</li>
1524</ul>
1525<DIV>
1526<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-n</em>
1527</h4>
1528<UL>
1529<LI CLASS="ListVariable">Sets no password for the user.</li>
1530</ul>
1531</div>
1532</div>
1533<DIV>
1534<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-s</em>
1535 <EM CLASS="Replaceable">username</em>
1536</h4>
1537<UL>
1538<LI CLASS="ListVariable">Causes <EM CLASS="Emphasis">smbpasswd</em>
1539 to be silent and to read its old and new passwords from standard input, rather than from <EM CLASS="Filename">/dev/tty</em>. This is useful for writing scripts.</li>
1540</ul>
1541</div>
1542</div>
1543<DIV>
1544<H3 CLASS="HeadB">testparm</h3>
1545<P CLASS="Body">The <EM CLASS="Emphasis">testparm</em>
1546 program checks an <EM CLASS="Filename">smb.conf</em>
1547 file for obvious errors and self-consistency. Its command line is:</p>
1548<P CLASS="Code">testparm [options] <EM CLASS="Replaceable">configfile_name [hostname IP_addr]</em>
1549</p>
1550<P CLASS="Body">If the configuration file is not specified, the file at <EM CLASS="Replaceable">samba_dir</em>
1551<EM CLASS="Filename">/lib/smb.conf</em>
1552 is checked by default. If you specify a hostname and an IP address, an extra check will be made to ensure that the specified machine would be allowed to connect to Samba. If a hostname is specified, an IP address should be present as well.</p>
1553<DIV>
1554<H4 CLASS="HeadC">Options</h4>
1555</div>
1556<DIV>
1557<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-h</em>
1558</h4>
1559<UL>
1560<LI CLASS="ListVariable">Prints command-line information for the program.</li>
1561</ul>
1562</div>
1563<DIV>
1564<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-L</em>
1565 server_name</h4>
1566<UL>
1567<LI CLASS="ListVariable">Resets the <EM CLASS="Literal">%L</em>
1568 configuration variable to the specified server name. </li>
1569</ul>
1570<DIV>
1571<H4 CLASS="ListVariableTermRunin"><EM CLASS="Literal">-s</em>
1572</h4>
1573<UL>
1574<LI CLASS="ListVariable">This option prevents the <EM CLASS="Emphasis">testparm</em>
1575 program from prompting the user to press the Enter key before printing a list of the configuration options for the server.</li>
1576</ul>
1577</div>
1578</div>
1579</div>
1580<DIV>
1581<H3 CLASS="HeadB">testprns</h3>
1582<P CLASS="Body">The <EM CLASS="Emphasis">testprns</em>
1583 program checks a specified printer name against the system printer capabilities (<EM CLASS="Filename">printcap</em>) file. Its command line is:</p>
1584<P CLASS="Code">testprns <EM CLASS="Replaceable">printername</em>
1585 [<EM CLASS="Replaceable">printcapname</em>]</p>
1586<P CLASS="Body">If the <EM CLASS="Literal">printcapname</em>
1587 isn't specified, Samba attempts to use one located in the <EM CLASS="Filename">smb.conf</em>
1588 file. If one isn't specified there, Samba will try <EM CLASS="Filename">/etc/printcap</em>. If that fails, the program will generate an error.</p>
1589</div>
1590<DIV>
1591<H3 CLASS="HeadB">rpcclient</h3>
1592<P CLASS="Body">This is a new client that exercises the RPC (remote procedure call) interfaces of an SMB server. Like <EM CLASS="Emphasis">smbclient</em>, <EM CLASS="Emphasis">rpcclient</em>
1593 started its life as a test program for the Samba developers and will likely stay that way for a while. Its command line is:</p>
1594<P CLASS="Code">rpcclient //<EM CLASS="Replaceable">server</em>/<EM CLASS="Replaceable">share</em>
1595</p>
1596<P CLASS="Body">The command-line options are the same as the Samba 2.0 <EM CLASS="Emphasis">smbclient</em>, and the operations you can try are listed below. </p>
1597<TABLE>
1598<CAPTION>
1599<H4 CLASS="TableLabel"><A NAME="65243"></a>&nbsp;</h4>
1600<H4 CLASS="TableTitle">rpcclient commands </h4>
1601</caption>
1602<TR>
1603<TH ROWSPAN="1" COLSPAN="1">
1604<P CLASS="CellHeading">Command</p>
1605</th>
1606<TH ROWSPAN="1" COLSPAN="1">
1607<P CLASS="CellHeading">Description</p>
1608</th>
1609</tr>
1610<TR>
1611<TD ROWSPAN="1" COLSPAN="1">
1612<P CLASS="CellBody"><EM CLASS="Literal">regenum keyname</em>
1613</p>
1614</td>
1615<TD ROWSPAN="1" COLSPAN="1">
1616<P CLASS="CellBody">Registry Enumeration (keys, values)</p>
1617</td>
1618</tr>
1619<TR>
1620<TD ROWSPAN="1" COLSPAN="1">
1621<P CLASS="CellBody"><EM CLASS="Literal">regdeletekey keyname </em>
1622</p>
1623</td>
1624<TD ROWSPAN="1" COLSPAN="1">
1625<P CLASS="CellBody">Registry Key Delete</p>
1626</td>
1627</tr>
1628<TR>
1629<TD ROWSPAN="1" COLSPAN="1">
1630<P CLASS="CellBody"><EM CLASS="Literal">regcreatekey keyname [keyvalue]</em>
1631</p>
1632</td>
1633<TD ROWSPAN="1" COLSPAN="1">
1634<P CLASS="CellBody">Registry Key Create</p>
1635</td>
1636</tr>
1637<TR>
1638<TD ROWSPAN="1" COLSPAN="1">
1639<P CLASS="CellBody"><EM CLASS="Literal">regquerykey keyname</em>
1640</p>
1641</td>
1642<TD ROWSPAN="1" COLSPAN="1">
1643<P CLASS="CellBody">Registry Key Query</p>
1644</td>
1645</tr>
1646<TR>
1647<TD ROWSPAN="1" COLSPAN="1">
1648<P CLASS="CellBody"><EM CLASS="Literal">regdeleteval valname</em>
1649</p>
1650</td>
1651<TD ROWSPAN="1" COLSPAN="1">
1652<P CLASS="CellBody">Registry Value Delete</p>
1653</td>
1654</tr>
1655<TR>
1656<TD ROWSPAN="1" COLSPAN="1">
1657<P CLASS="CellBody"><EM CLASS="Literal">regcreateval valname valtype value</em>
1658</p>
1659</td>
1660<TD ROWSPAN="1" COLSPAN="1">
1661<P CLASS="CellBody">Registry Key Create</p>
1662</td>
1663</tr>
1664<TR>
1665<TD ROWSPAN="1" COLSPAN="1">
1666<P CLASS="CellBody"><EM CLASS="Literal">reggetsec keyname</em>
1667</p>
1668</td>
1669<TD ROWSPAN="1" COLSPAN="1">
1670<P CLASS="CellBody">Registry Key Security</p>
1671</td>
1672</tr>
1673<TR>
1674<TD ROWSPAN="1" COLSPAN="1">
1675<P CLASS="CellBody"><EM CLASS="Literal">regtestsec keyname</em>
1676</p>
1677</td>
1678<TD ROWSPAN="1" COLSPAN="1">
1679<P CLASS="CellBody">Test Registry Key Security</p>
1680</td>
1681</tr>
1682<TR>
1683<TD ROWSPAN="1" COLSPAN="1">
1684<P CLASS="CellBody"><EM CLASS="Literal">ntlogin [username] [password]</em>
1685</p>
1686</td>
1687<TD ROWSPAN="1" COLSPAN="1">
1688<P CLASS="CellBody">NT Domain Login Test</p>
1689</td>
1690</tr>
1691<TR>
1692<TD ROWSPAN="1" COLSPAN="1">
1693<P CLASS="CellBody"><EM CLASS="Literal">wksinfo</em>
1694</p>
1695</td>
1696<TD ROWSPAN="1" COLSPAN="1">
1697<P CLASS="CellBody">Workstation Query Info</p>
1698</td>
1699</tr>
1700<TR>
1701<TD ROWSPAN="1" COLSPAN="1">
1702<P CLASS="CellBody"><EM CLASS="Literal">srvinfo</em>
1703</p>
1704</td>
1705<TD ROWSPAN="1" COLSPAN="1">
1706<P CLASS="CellBody">Server Query Info</p>
1707</td>
1708</tr>
1709<TR>
1710<TD ROWSPAN="1" COLSPAN="1">
1711<P CLASS="CellBody"><EM CLASS="Literal">srvsessions</em>
1712</p>
1713</td>
1714<TD ROWSPAN="1" COLSPAN="1">
1715<P CLASS="CellBody">List Sessions on a Server</p>
1716</td>
1717</tr>
1718<TR>
1719<TD ROWSPAN="1" COLSPAN="1">
1720<P CLASS="CellBody"><EM CLASS="Literal">srvshares</em>
1721</p>
1722</td>
1723<TD ROWSPAN="1" COLSPAN="1">
1724<P CLASS="CellBody">List shares on a server</p>
1725</td>
1726</tr>
1727<TR>
1728<TD ROWSPAN="1" COLSPAN="1">
1729<P CLASS="CellBody"><EM CLASS="Literal">srvconnections</em>
1730</p>
1731</td>
1732<TD ROWSPAN="1" COLSPAN="1">
1733<P CLASS="CellBody">List connections on a server </p>
1734</td>
1735</tr>
1736<TR>
1737<TD ROWSPAN="1" COLSPAN="1">
1738<P CLASS="CellBody"><EM CLASS="Literal">srvfiles</em>
1739</p>
1740</td>
1741<TD ROWSPAN="1" COLSPAN="1">
1742<P CLASS="CellBody">List files on a server</p>
1743</td>
1744</tr>
1745<TR>
1746<TD ROWSPAN="1" COLSPAN="1">
1747<P CLASS="CellBody"><EM CLASS="Literal">lsaquery</em>
1748</p>
1749</td>
1750<TD ROWSPAN="1" COLSPAN="1">
1751<P CLASS="CellBody">Query Info Policy (domain member or server)</p>
1752</td>
1753</tr>
1754<TR>
1755<TD ROWSPAN="1" COLSPAN="1">
1756<P CLASS="CellBody"><EM CLASS="Literal">lookupsids</em>
1757</p>
1758</td>
1759<TD ROWSPAN="1" COLSPAN="1">
1760<P CLASS="CellBody">Resolve names from SIDs</p>
1761</td>
1762</tr>
1763<TR>
1764<TD ROWSPAN="1" COLSPAN="1">
1765<P CLASS="CellBody"><EM CLASS="Literal">ntpass</em>
1766</p>
1767</td>
1768<TD ROWSPAN="1" COLSPAN="1">
1769<P CLASS="CellBody">NT SAM Password Change</p>
1770</td>
1771</tr>
1772</table>
1773</div>
1774<DIV>
1775<H3 CLASS="HeadB">tcpdump</h3>
1776<P CLASS="Body">The <EM CLASS="Emphasis">tcpdump</em>
1777 utility, a classic system administration tool, dumps all the packet headers it sees on an interface that match an expression. The version included in the Samba distribution is enhanced to understand the SMB protocol. The <EM CLASS="Emphasis">expression</em>
1778 is a logical expression with &quot;and,&quot; &quot;or,&quot; and &quot;not,&quot; although sometimes it's very simple. For example, <EM CLASS="Literal">host</em>
1779 <EM CLASS="Literal">escrime</em>
1780 would select every packet going to or from <EM CLASS="Literal">escrime</em>. The expression is normally one or more of:</p>
1781<UL>
1782<LI CLASS="ListBullet"><EM CLASS="Literal">host</em>
1783 <EM CLASS="Replaceable">name</em>
1784</li>
1785<LI CLASS="ListBullet"><EM CLASS="Literal">net network_number</em>
1786</li>
1787<LI CLASS="ListBullet"><EM CLASS="Literal">port</em>
1788 <EM CLASS="Replaceable">number</em>
1789</li>
1790<LI CLASS="ListBullet"><EM CLASS="Literal">src</em>
1791 <EM CLASS="Replaceable">name </em>
1792</li>
1793<LI CLASS="ListBullet"><EM CLASS="Literal">dst</em>
1794 <EM CLASS="Replaceable">name</em>
1795 </li>
1796</ul>
1797<P CLASS="Body">The most common options are <EM CLASS="Literal">src</em>
1798 (source), <EM CLASS="Literal">dst</em>
1799 (destination), and <EM CLASS="Literal">port</em>. For example, in the book we used the command: </p>
1800<P CLASS="Code">tcpdump port not telnet</p>
1801<P CLASS="Body">This dumps all the packets except telnet; we were logged-in via telnet and  wanted to see only the SMB packets. </p>
1802<P CLASS="Body">Another <EM CLASS="Emphasis">tcpdump</em>
1803 example is selecting traffic between server and either <EM CLASS="Literal">sue</em>
1804 or <EM CLASS="Literal">joe</em>:</p>
1805<P CLASS="Code">tcpdump host server and &#92;(sue or joe &#92;)</p>
1806<P CLASS="Body">We recommend using the <EM CLASS="Literal">-s</em>
1807 <EM CLASS="Literal">1500</em>
1808 option so that you capture all of the SMB messages sent, instead of just the header information. </p>
1809<DIV>
1810<H4 CLASS="HeadC">Options</h4>
1811<P CLASS="Body">There are many options, and many other kinds of expressions that can be used with <EM CLASS="Emphasis">tcpdump</em>. See the manual page for details on the advanced options. The most common options are as follows: </p>
1812</div>
1813<DIV>
1814<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-c</em>
1815 <EM CLASS="Replaceable">count</em>
1816</h4>
1817<UL>
1818<LI CLASS="ListVariable">Forces the program to exit after receiving the specified number of packets.</li>
1819</ul>
1820</div>
1821<DIV>
1822<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-F</em>
1823 <EM CLASS="Replaceable">file</em>
1824</h4>
1825<UL>
1826<LI CLASS="ListVariable">Reads the expression from the specified file and ignores expressions on the command line.</li>
1827</ul>
1828</div>
1829<DIV>
1830<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-i</em>
1831 <EM CLASS="Replaceable">interface</em>
1832</h4>
1833<UL>
1834<LI CLASS="ListVariable">Forces the program to listen on the specified interface.</li>
1835</ul>
1836</div>
1837<DIV>
1838<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-r</em>
1839 <EM CLASS="Replaceable">file</em>
1840</h4>
1841<UL>
1842<LI CLASS="ListVariable">Reads packets from the specified file (captured with <EM CLASS="Literal">-w</em>).</li>
1843</ul>
1844</div>
1845<DIV>
1846<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-s</em>
1847 <EM CLASS="Replaceable">length</em>
1848</h4>
1849<UL>
1850<LI CLASS="ListVariable">Saves the specified number of bytes of data from each packet (rather than 68 bytes).</li>
1851</ul>
1852</div>
1853<DIV>
1854<H4 CLASS="ListVariableTerm"><EM CLASS="Literal">-w</em>
1855 <EM CLASS="Replaceable">file</em>
1856</h4>
1857<UL>
1858<LI CLASS="ListVariable">Writes the packets to the specified file.</li>
1859</ul>
1860</div>
1861</div>
1862</div>
1863</div>
1864</blockquote>
1865
1866
1867<div>
1868<center>
1869<hr noshade size=1><TABLE WIDTH="515" BORDER="0" CELLSPACING="0" CELLPADDING="0">
1870<TR>
1871<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172">
1872<A CLASS="appendix" HREF="appc_01.html" TITLE="">
1873<IMG SRC="gifs/txtpreva.gif" ALT="Previous: Appendix C." BORDER="0"></a></td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171">
1874<A CLASS="book" HREF="index.html" TITLE="">
1875<IMG SRC="gifs/txthome.gif" ALT="" BORDER="0"></a></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172">
1876<A CLASS="appendix" HREF="appe_01.html" TITLE="">
1877<IMG SRC="gifs/txtnexta.gif" ALT="Next: Appendix E." BORDER="0"></a></td></tr><TR>
1878<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172">
1879C. Samba Configuration Option Quick Reference</td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171">
1880<A CLASS="index" HREF="inx.html" TITLE="Book Index">
1881<IMG SRC="gifs/index.gif" ALT="Book Index" BORDER="0"></a></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172">
1882E. Downloading Samba with CVS</td></tr></table><hr noshade size=1></center>
1883</div>
1884
1885<!-- End of sample chapter -->
1886<CENTER>
1887<FONT SIZE="1" FACE="Verdana, Arial, Helvetica">
1888<A HREF="http://www.oreilly.com/">
1889<B>O'Reilly Home</B></A> <B> | </B>
1890<A HREF="http://www.oreilly.com/sales/bookstores">
1891<B>O'Reilly Bookstores</B></A> <B> | </B>
1892<A HREF="http://www.oreilly.com/order_new/">
1893<B>How to Order</B></A> <B> | </B>
1894<A HREF="http://www.oreilly.com/oreilly/contact.html">
1895<B>O'Reilly Contacts<BR></B></A>
1896<A HREF="http://www.oreilly.com/international/">
1897<B>International</B></A> <B> | </B>
1898<A HREF="http://www.oreilly.com/oreilly/about.html">
1899<B>About O'Reilly</B></A> <B> | </B>
1900<A HREF="http://www.oreilly.com/affiliates.html">
1901<B>Affiliated Companies</B></A><p>
1902<EM>&copy; 1999, O'Reilly &amp; Associates, Inc.</EM>
1903</FONT>
1904</CENTER>
1905</BODY>
1906
1907</html>
1908