4f36de157671072c15243ed0a0eefc03e1650d17
[tprouty/samba.git] / docs / docbook / manpages / smbclient.1.sgml
1 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
2 <refentry id="smbclient">
3
4 <refmeta>
5         <refentrytitle>smbclient</refentrytitle>
6         <manvolnum>1</manvolnum>
7 </refmeta>
8
9
10 <refnamediv>
11         <refname>smbclient</refname>
12         <refpurpose>ftp-like client to access SMB/CIFS resources 
13         on servers</refpurpose>
14 </refnamediv>
15
16 <refsynopsisdiv>
17         <cmdsynopsis>
18                 <command>smbclient</command>
19                 <arg choice="req">servicename</arg>
20                 <arg choice="opt">password</arg>
21                 <arg choice="opt">-b &lt;buffer size&gt;</arg>
22                 <arg choice="opt">-d debuglevel</arg>
23                 <arg choice="opt">-D Directory</arg>
24                 <arg choice="opt">-U username</arg>
25                 <arg choice="opt">-W workgroup</arg>
26                 <arg choice="opt">-M &lt;netbios name&gt;</arg>
27                 <arg choice="opt">-m maxprotocol</arg>
28                 <arg choice="opt">-A authfile</arg>
29                 <arg choice="opt">-N</arg>
30                 <arg choice="opt">-l logfile</arg>
31                 <arg choice="opt">-L &lt;netbios name&gt;</arg>
32                 <arg choice="opt">-I destinationIP</arg>
33                 <arg choice="opt">-E &lt;terminal code&gt;</arg>
34                 <arg choice="opt">-c &lt;command string&gt;</arg>
35                 <arg choice="opt">-i scope</arg>
36                 <arg choice="opt">-O &lt;socket options&gt;</arg>
37                 <arg choice="opt">-p port</arg>
38                 <arg choice="opt">-R &lt;name resolve order&gt;</arg>
39                 <arg choice="opt">-s &lt;smb config file&gt;</arg>
40                 <arg choice="opt">-T&lt;c|x&gt;IXFqgbNan</arg>
41         </cmdsynopsis>
42 </refsynopsisdiv>
43
44 <refsect1>
45         <title>DESCRIPTION</title>
46
47         <para>This tool is part of the <ulink url="samba.7.html">
48         Samba</ulink> suite.</para>
49
50         <para><command>smbclient</command> is a client that can 
51         'talk' to an SMB/CIFS server. It offers an interface
52         similar to that of the ftp program (see <command>ftp(1)</command>).  
53         Operations include things like getting files from the server 
54         to the local machine, putting files from the local machine to 
55         the server, retrieving directory information from the server 
56         and so on. </para>
57 </refsect1>
58
59
60 <refsect1>
61         <title>OPTIONS</title>
62         
63         <variablelist>
64                 <varlistentry>
65                 <term>servicename</term>
66                 <listitem><para>servicename is the name of the service 
67                 you want to use on the server. A service name takes the form
68                 <filename>//server/service</filename> where <parameter>server
69                 </parameter> is the NetBIOS name of the SMB/CIFS server 
70                 offering the desired service and <parameter>service</parameter> 
71                 is the name of the service offered.  Thus to connect to 
72                 the service "printer" on the SMB/CIFS server "smbserver",
73                 you would use the servicename <filename>//smbserver/printer
74                 </filename></para>
75
76                 <para>Note that the server name required is NOT necessarily 
77                 the IP (DNS) host name of the server !  The name required is 
78                 a NetBIOS server name, which may or may not be the
79                 same as the IP hostname of the machine running the server.
80                 </para>
81
82                 <para>The server name is looked up according to either 
83                 the <parameter>-R</parameter> parameter to <command>smbclient</command> or 
84                 using the name resolve order parameter in the <filename>smb.conf</filename> file, 
85                 allowing an administrator to change the order and methods 
86                 by which server names are looked up. </para></listitem>
87                 </varlistentry>
88
89                 <varlistentry>
90                 <term>password</term>
91                 <listitem><para>The password required to access the specified 
92                 service on the specified server. If this parameter is 
93                 supplied, the <parameter>-N</parameter> option (suppress 
94                 password prompt) is assumed. </para>
95
96                 <para>There is no default password. If no password is supplied 
97                 on the command line (either by using this parameter or adding 
98                 a password to the <parameter>-U</parameter> option (see 
99                 below)) and the <parameter>-N</parameter> option is not 
100                 specified, the client will prompt for a password, even if 
101                 the desired service does not require one. (If no password is 
102                 required, simply press ENTER to provide a null password.)
103                 </para>
104
105                 <para>Note: Some servers (including OS/2 and Windows for 
106                 Workgroups) insist on an uppercase password. Lowercase 
107                 or mixed case passwords may be rejected by these servers.               
108                 </para>
109
110                 <para>Be cautious about including passwords in scripts.
111                 </para></listitem>
112                 </varlistentry>
113                 
114                 <varlistentry>
115                 <term>-s smb.conf</term>
116                 <listitem><para>Specifies the location of the all important 
117                 <filename>smb.conf</filename> file. </para></listitem>
118                 </varlistentry>
119                 
120                 <varlistentry>
121                 <term>-O socket options</term>
122                 <listitem><para>TCP socket options to set on the client 
123                 socket. See the socket options parameter in the <filename>
124                 smb.conf (5)</filename> manpage for the list of valid 
125                 options. </para></listitem>
126                 </varlistentry>
127
128
129                 <varlistentry>
130                 <term>-R &lt;name resolve order&gt;</term> 
131                 <listitem><para>This option is used by the programs in the Samba 
132                 suite to determine what naming services and in what order to resolve 
133                 host names to IP addresses. The option takes a space-separated 
134                 string of different name resolution options.</para>
135
136                 <para>The options are :"lmhosts", "host", "wins" and "bcast". They 
137                 cause names to be resolved as follows :</para>
138
139                 <itemizedlist>
140                         <listitem><para><constant>lmhosts</constant> : Lookup an IP 
141                         address in the Samba lmhosts file. If the line in lmhosts has 
142                         no name type attached to the NetBIOS name (see the <ulink 
143                         url="lmhosts.5.html">lmhosts(5)</ulink> for details) then
144                         any name type matches for lookup.</para></listitem>
145
146                         <listitem><para><constant>host</constant> : Do a standard host 
147                         name to IP address resolution, using the system <filename>/etc/hosts
148                         </filename>, NIS, or DNS lookups. This method of name resolution 
149                         is operating system dependent, for instance on IRIX or Solaris this 
150                         may be controlled by the <filename>/etc/nsswitch.conf</filename> 
151                         file).  Note that this method is only used if the NetBIOS name 
152                         type being queried is the 0x20 (server) name type, otherwise 
153                         it is ignored.</para></listitem>
154
155                         <listitem><para><constant>wins</constant> : Query a name with 
156                         the IP address listed in the <parameter>wins server</parameter>
157                         parameter.  If no WINS server has
158                         been specified this method will be ignored.</para></listitem>
159
160                         <listitem><para><constant>bcast</constant> : Do a broadcast on 
161                         each of the known local interfaces listed in the 
162                         <parameter>interfaces</parameter>
163                         parameter. This is the least reliable of the name resolution 
164                         methods as it depends on the target host being on a locally 
165                         connected subnet.</para></listitem>
166                 </itemizedlist>
167
168                 <para>If this parameter is not set then the name resolve order 
169                 defined in the <filename>smb.conf</filename> file parameter  
170                 (name resolve order) will be used. </para>
171
172                 <para>The default order is lmhosts, host, wins, bcast and without 
173                 this parameter or any entry in the <parameter>name resolve order
174                 </parameter> parameter of the <filename>smb.conf</filename> file the name resolution
175                 methods will be attempted in this order. </para></listitem>
176                 </varlistentry>
177                 
178                 
179                 <varlistentry>
180                 <term>-M NetBIOS name</term>
181                 <listitem><para>This options allows you to send messages, using 
182                 the "WinPopup" protocol, to another computer. Once a connection is 
183                 established you then type your message, pressing ^D (control-D) to 
184                 end. </para>
185
186                 <para>If the receiving computer is running WinPopup the user will 
187                 receive the message and probably a beep. If they are not running 
188                 WinPopup the message will be lost, and no error message will 
189                 occur. </para>
190
191                 <para>The message is also automatically truncated if the message 
192                 is over 1600 bytes, as this is the limit of the protocol. 
193                 </para>
194
195                 <para>One useful trick is to cat the message through
196                 <command>smbclient</command>. For example: <command>
197                 cat mymessage.txt | smbclient -M FRED </command> will 
198                 send the message in the file <filename>mymessage.txt</filename> 
199                 to the machine FRED. </para>
200
201                 <para>You may also find the <parameter>-U</parameter> and 
202                 <parameter>-I</parameter> options useful, as they allow you to 
203                 control the FROM and TO parts of the message. </para>
204
205                 <para>See the message command parameter in the <filename>
206                 smb.conf(5)</filename> for a description of how to handle incoming 
207                 WinPopup messages in Samba. </para>
208
209                 <para><emphasis>Note</emphasis>: Copy WinPopup into the startup group 
210                 on your WfWg PCs if you want them to always be able to receive 
211                 messages. </para></listitem>
212                 </varlistentry>
213                 
214                 <varlistentry>
215                 <term>-i scope</term>
216                 <listitem><para>This specifies a NetBIOS scope that smbclient will 
217                 use to communicate with when generating NetBIOS names. For details 
218                 on the use of NetBIOS scopes, see <filename>rfc1001.txt</filename> 
219                 and <filename>rfc1002.txt</filename>.
220                 NetBIOS scopes are <emphasis>very</emphasis> rarely used, only set 
221                 this parameter if you are the system administrator in charge of all 
222                 the NetBIOS systems you communicate with. </para></listitem>
223                 </varlistentry>
224                 
225                 
226                 <varlistentry>
227                 <term>-N</term>
228                 <listitem><para>If specified, this parameter suppresses the normal 
229                 password prompt from the client to the user. This is useful when 
230                 accessing a service that does not require a password. </para>
231
232                 <para>Unless a password is specified on the command line or 
233                 this parameter is specified, the client will request a 
234                 password.</para></listitem>
235                 </varlistentry>
236                 
237                 
238                 
239                 <varlistentry>
240                 <term>-n NetBIOS name</term>
241                 <listitem><para>By default, the client will use the local 
242                 machine's hostname (in uppercase) as its NetBIOS name. This parameter 
243                 allows you to override the host name and use whatever NetBIOS 
244                 name you wish. </para></listitem>
245                 </varlistentry>
246                 
247                 
248                 <varlistentry>
249                 <term>-d debuglevel</term>
250                 <listitem><para><replaceable>debuglevel</replaceable> is an integer from 0 to 10, or 
251                 the letter 'A'. </para>
252                 
253                 <para>The default value if this parameter is not specified 
254                 is zero. </para>
255
256                 <para>The higher this value, the more detail will be logged to 
257                 the log files about the activities of the 
258                 client. At level 0, only critical errors and serious warnings will 
259                 be logged. Level 1 is a reasonable level for day to day running - 
260                 it generates a small amount of information about operations 
261                 carried out. </para>
262                 
263                 <para>Levels above 1 will generate considerable amounts of log 
264                 data, and should only be used when investigating a problem.
265                 Levels above 3 are designed for use only by developers and 
266                 generate HUGE amounts of log data, most of which is extremely 
267                 cryptic. If <replaceable>debuglevel</replaceable> is set to the letter 'A', then <emphasis>all
268                 </emphasis>  debug messages will be printed. This setting
269                 is for developers only (and people who <emphasis>really</emphasis> want 
270                 to know how the code works internally). </para>
271
272                 <para>Note that specifying this parameter here will override
273                 the log level parameter in the <filename>smb.conf (5)</filename> 
274                 file. </para></listitem>
275                 </varlistentry>
276                 
277                 
278                 <varlistentry>
279                 <term>-p port</term>
280                 <listitem><para>This number is the TCP port number that will be used 
281                 when making connections to the server. The standard (well-known)
282                 TCP port number for an SMB/CIFS server is 139, which is the 
283                 default. </para></listitem>
284                 </varlistentry>
285                 
286                 
287                 <varlistentry>
288                 <term>-l logfilename</term>
289                 <listitem><para>If specified, <replaceable>logfilename</replaceable> specifies a base filename 
290                 into which operational data from the running client will be 
291                 logged. </para>
292
293                 <para>The default base name is specified at compile time.</para>
294
295                 <para>The base name is used to generate actual log file names.
296                 For example, if the name specified was "log", the debug file 
297                 would be <filename>log.client</filename>.</para>
298                 
299                 <para>The log file generated is never removed by the client.            
300                 </para></listitem>
301                 </varlistentry>
302                 
303                 
304                 
305                 <varlistentry>
306                 <term>-h</term><listitem>
307                 <para>Print the usage message for the client. </para></listitem>
308                 </varlistentry>
309                 
310                 
311                 
312                 <varlistentry>
313                 <term>-I IP-address</term>
314                 <listitem><para><replaceable>IP address</replaceable> is the address of the server to connect to. 
315                 It should be specified in standard "a.b.c.d" notation. </para>
316
317                 <para>Normally the client would attempt to locate a named 
318                 SMB/CIFS server by looking it up via the NetBIOS name resolution 
319                 mechanism described above in the <parameter>name resolve order</parameter> 
320                 parameter above. Using this parameter will force the client
321                 to assume that the server is on the machine with the specified IP 
322                 address and the NetBIOS name component of the resource being 
323                 connected to will be ignored. </para>
324
325                 <para>There is no default for this parameter. If not supplied, 
326                 it will be determined automatically by the client as described 
327                 above. </para></listitem>
328                 </varlistentry>
329                 
330                 
331                 
332                 <varlistentry>
333                 <term>-E</term>
334                 <listitem><para>This parameter causes the client to write messages 
335                 to the standard error stream (stderr) rather than to the standard 
336                 output stream. </para>
337                 
338                 <para>By default, the client writes messages to standard output 
339                 - typically the user's tty. </para></listitem>
340                 </varlistentry>
341                 
342                 
343                 <varlistentry>
344                 <term>-U username[%pass]</term>
345                 <listitem><para>Sets the SMB username or username and password. 
346                 If %pass is not specified, The user will be prompted. The client 
347                 will first check the <envar>USER</envar> environment variable, then the 
348                 <envar>LOGNAME</envar> variable and if either exists, the 
349                 string is uppercased. Anything in these variables following a '%' 
350                 sign will be treated as the password. If these environment 
351                 variables are not found, the username <constant>GUEST</constant> 
352                 is used. </para>
353
354                 <para>If the password is not included in these environment
355                 variables (using the %pass syntax), <command>smbclient</command> will look for 
356                 a <envar>PASSWD</envar> environment variable from which 
357                 to read the password. </para>
358                 
359                 <para>A third option is to use a credentials file which 
360                 contains the plaintext of the domain name, username and password.  This 
361                 option is mainly provided for scripts where the admin doesn't 
362                 wish to pass the credentials on the command line or via environment 
363                 variables. If this method is used, make certain that the permissions 
364                 on the file restrict access from unwanted users.  See the 
365                 <parameter>-A</parameter> for more details. </para>
366                 
367                 <para>Be cautious about including passwords in scripts or in 
368                 the <envar>PASSWD</envar> environment variable. Also, on 
369                 many systems the command line of a running process may be seen 
370                 via the <command>ps</command> command to be safe always allow 
371                 <command>smbclient</command> to prompt for a password and type 
372                 it in directly. </para></listitem>
373                 </varlistentry>
374                 
375                 
376                 <varlistentry>
377                 <term>-A filename</term><listitem><para>This option allows 
378                 you to specify a file from which to read the username, domain name, and 
379                 password used in the connection.  The format of the file is 
380                 </para>
381                 
382                 <para><programlisting>
383 username = &lt;value&gt; 
384 password = &lt;value&gt;
385 domain = &lt;value&gt;
386                 </programlisting></para>
387         
388
389                 <para>If the domain parameter is missing the current workgroup name
390                 is used instead. Make certain that the permissions on the file restrict 
391                 access from unwanted users. </para></listitem>
392                 </varlistentry>
393
394
395
396                 <varlistentry>
397                 <term>-L</term>
398                 <listitem><para>This option allows you to look at what services 
399                 are available on a server. You use it as <command>smbclient -L 
400                 host</command> and a list should appear.  The <parameter>-I
401                 </parameter> option may be useful if your NetBIOS names don't 
402                 match your TCP/IP DNS host names or if you are trying to reach a 
403                 host on another network. </para></listitem>
404                 </varlistentry>
405                 
406                 
407                 <varlistentry>
408                 <term>-t terminal code</term>
409                 <listitem><para>This option tells <command>smbclient</command> how to interpret 
410                 filenames coming from the remote server. Usually Asian language 
411                 multibyte UNIX implementations use different character sets than 
412                 SMB/CIFS servers (<emphasis>EUC</emphasis> instead of <emphasis>
413                 SJIS</emphasis> for example). Setting this parameter will let 
414                 <command>smbclient</command> convert between the UNIX filenames and 
415                 the SMB filenames correctly. This option has not been seriously tested 
416                 and may have some problems. </para>
417
418                 <para>The terminal codes include CWsjis, CWeuc, CWjis7, CWjis8,
419                 CWjunet, CWhex, CWcap. This is not a complete list, check the Samba 
420                 source code for the complete list. </para></listitem>
421                 </varlistentry>
422                 
423                         
424                 <varlistentry>  
425                 <term>-b buffersize</term>
426                 <listitem><para>This option changes the transmit/send buffer 
427                 size when getting or putting a file from/to the server. The default 
428                 is 65520 bytes. Setting this value smaller (to 1200 bytes) has been 
429                 observed to speed up file transfers to and from a Win9x server. 
430                 </para></listitem>
431                 </varlistentry>
432                 
433                 
434                 
435                 <varlistentry>
436                 <term>-W WORKGROUP</term>
437                 <listitem><para>Override the default workgroup specified in the 
438                 workgroup parameter of the <filename>smb.conf</filename> file 
439                 for this connection. This may be needed to connect to some 
440                 servers. </para></listitem>
441                 </varlistentry>
442                 
443                 
444                 <varlistentry>
445                 <term>-T tar options</term>
446                 <listitem><para>smbclient may be used to create <command>tar(1)
447                 </command> compatible backups of all the files on an SMB/CIFS
448                 share. The secondary tar flags that can be given to this option 
449                 are : </para>
450                 
451                 <itemizedlist>
452                         <listitem><para><parameter>c</parameter> - Create a tar file on UNIX. 
453                         Must be followed by the name of a tar file, tape device
454                         or "-" for standard output. If using standard output you must 
455                         turn the log level to its lowest value -d0 to avoid corrupting 
456                         your tar file. This flag is mutually exclusive with the 
457                         <parameter>x</parameter> flag. </para></listitem>
458                         
459                         <listitem><para><parameter>x</parameter> - Extract (restore) a local 
460                         tar file back to a share. Unless the -D option is given, the tar 
461                         files will be restored from the top level of the share. Must be 
462                         followed by the name of the tar file, device or "-" for standard 
463                         input. Mutually exclusive with the <parameter>c</parameter> flag. 
464                         Restored files have their creation times (mtime) set to the
465                         date saved in the tar file. Directories currently do not get 
466                         their creation dates restored properly. </para></listitem>
467                         
468                         <listitem><para><parameter>I</parameter> - Include files and directories. 
469                         Is the default behavior when filenames are specified above. Causes 
470                         tar files to be included in an extract or create (and therefore 
471                         everything else to be excluded). See example below.  Filename globbing 
472                         works  in one of two ways.  See r below. </para></listitem>
473                         
474                         <listitem><para><parameter>X</parameter> - Exclude files and directories. 
475                         Causes tar files to be excluded from an extract or create. See 
476                         example below.  Filename globbing works in one of two ways now. 
477                         See <parameter>r</parameter> below. </para></listitem>
478                         
479                         <listitem><para><parameter>b</parameter> - Blocksize. Must be followed 
480                         by a valid (greater than zero) blocksize.  Causes tar file to be 
481                         written out in blocksize*TBLOCK (usually 512 byte) blocks. 
482                         </para></listitem>
483                         
484                         <listitem><para><parameter>g</parameter> - Incremental. Only back up 
485                         files that have the archive bit set. Useful only with the 
486                         <parameter>c</parameter> flag. </para></listitem>
487
488                         <listitem><para><parameter>q</parameter> - Quiet. Keeps tar from printing 
489                         diagnostics as it works.  This is the same as tarmode quiet. 
490                         </para></listitem>
491                         
492                         <listitem><para><parameter>r</parameter> - Regular expression include
493                         or exclude.  Uses regular  expression matching for 
494                         excluding or excluding files if  compiled with HAVE_REGEX_H. 
495                         However this mode can be very slow. If  not compiled with 
496                         HAVE_REGEX_H, does a limited wildcard match on '*' and  '?'. 
497                         </para></listitem>
498                         
499                         <listitem><para><parameter>N</parameter> - Newer than. Must be followed 
500                         by the name of a file whose date is compared against files found 
501                         on the share during a create. Only files newer than the file 
502                         specified are backed up to the tar file. Useful only with the 
503                         <parameter>c</parameter> flag. </para></listitem>
504                         
505                         <listitem><para><parameter>a</parameter> - Set archive bit. Causes the 
506                         archive bit to be reset when a file is backed up. Useful with the 
507                         <parameter>g</parameter> and <parameter>c</parameter> flags. 
508                         </para></listitem>
509                 </itemizedlist>
510                         
511                 <para><emphasis>Tar Long File Names</emphasis></para>
512                         
513                 <para><command>smbclient</command>'s tar option now supports long 
514                 file names both on backup and restore. However, the full path 
515                 name of the file must be less than 1024 bytes.  Also, when
516                 a tar archive is created, <command>smbclient</command>'s tar option places all 
517                 files in the archive with relative names, not absolute names. 
518                 </para>
519                         
520                 <para><emphasis>Tar Filenames</emphasis></para>
521                         
522                 <para>All file names can be given as DOS path names (with '\' 
523                 as the component separator) or as UNIX path names (with '/' as 
524                 the component separator). </para>
525                         
526                 <para><emphasis>Examples</emphasis></para>
527                 
528                 <para>Restore from tar file <filename>backup.tar</filename> into myshare on mypc 
529                 (no password on share). </para>
530                 
531                 <para><command>smbclient //mypc/yshare "" -N -Tx backup.tar
532                 </command></para>
533                 
534                 <para>Restore everything except <filename>users/docs</filename>
535                 </para>
536                 
537                 <para><command>smbclient //mypc/myshare "" -N -TXx backup.tar 
538                 users/docs</command></para>
539                 
540                 <para>Create a tar file of the files beneath <filename>
541                 users/docs</filename>. </para>
542                 
543                 <para><command>smbclient //mypc/myshare "" -N -Tc
544                 backup.tar users/docs </command></para>
545                 
546                 <para>Create the same tar file as above, but now use 
547                 a DOS path name. </para>
548                 
549                 <para><command>smbclient //mypc/myshare "" -N -tc backup.tar 
550                 users\edocs </command></para>
551                 
552                 <para>Create a tar file of all the files and directories in 
553                 the share. </para>
554                 
555                 <para><command>smbclient //mypc/myshare "" -N -Tc backup.tar *
556                 </command></para>
557                 </listitem>
558                 </varlistentry>
559                 
560                 
561                 <varlistentry>
562                 <term>-D initial directory</term>
563                 <listitem><para>Change to initial directory before starting. Probably 
564                 only of any use with the tar -T option. </para></listitem>
565                 </varlistentry>
566                 
567                 
568                 
569                 <varlistentry>
570                 <term>-c command string</term>
571                 <listitem><para>command string is a semicolon-separated list of 
572                 commands to be executed instead of prompting from stdin. <parameter>
573                 -N</parameter> is implied by <parameter>-c</parameter>.</para>
574
575                 <para>This is particularly useful in scripts and for printing stdin 
576                 to the server, e.g. <command>-c 'print -'</command>. </para></listitem>
577                 </varlistentry>
578         </variablelist>
579 </refsect1>
580
581
582 <refsect1>
583         <title>OPERATIONS</title>
584
585         <para>Once the client is running, the user is presented with 
586         a prompt : </para>
587
588         <para><prompt>smb:\&gt; </prompt></para>
589
590         <para>The backslash ("\") indicates the current working directory 
591         on the server, and will change if the current working directory 
592         is changed. </para>
593
594         <para>The prompt indicates that the client is ready and waiting to 
595         carry out a user command. Each command is a single word, optionally 
596         followed by parameters specific to that command. Command and parameters 
597         are space-delimited unless these notes specifically
598         state otherwise. All commands are case-insensitive.  Parameters to 
599         commands may or may not be case sensitive, depending on the command. 
600         </para>
601
602         <para>You can specify file names which have spaces in them by quoting 
603         the name with double quotes, for example "a long file name". </para>
604
605         <para>Parameters shown in square brackets (e.g., "[parameter]") are 
606         optional.  If not given, the command will use suitable defaults. Parameters 
607         shown in angle brackets (e.g., "&lt;parameter&gt;") are required.
608         </para>
609
610
611         <para>Note that all commands operating on the server are actually 
612         performed by issuing a request to the server. Thus the behavior may 
613         vary from server to server, depending on how the server was implemented. 
614         </para>
615
616         <para>The commands available are given here in alphabetical order. </para>
617
618         <variablelist>
619                 <varlistentry>
620                 <term>? [command]</term>
621                 <listitem><para>If <replaceable>command</replaceable> is specified, the ? command will display 
622                 a brief informative message about the specified command.  If no 
623                 command is specified, a list of available commands will
624                 be displayed. </para></listitem>
625                 </varlistentry>
626                 
627                 
628                 <varlistentry>
629                 <term>! [shell command]</term>
630                 <listitem><para>If <replaceable>shell command</replaceable> is specified, the !  
631                 command will execute a shell locally and run the specified shell 
632                 command. If no command is specified, a local shell will be run. 
633                 </para></listitem>
634                 </varlistentry>
635                 
636                 
637                 
638                 <varlistentry>
639                 <term>cd [directory name]</term>
640                 <listitem><para>If "directory name" is specified, the current 
641                 working directory on the server will be changed to the directory 
642                 specified. This operation will fail if for any reason the specified 
643                 directory is inaccessible. </para>
644
645                 <para>If no directory name is specified, the current working 
646                 directory on the server will be reported. </para></listitem>
647                 </varlistentry>
648                 
649                 
650                 <varlistentry>
651                 <term>del &lt;mask&gt;</term>
652                 <listitem><para>The client will request that the server attempt 
653                 to delete all files matching <replaceable>mask</replaceable> from the current working 
654                 directory on the server. </para></listitem>
655                 </varlistentry>
656                 
657                 
658                 <varlistentry>
659                 <term>dir &lt;mask&gt;</term>
660                 <listitem><para>A list of the files matching <replaceable>mask</replaceable> in the current 
661                 working directory on the server will be retrieved from the server 
662                 and displayed. </para></listitem>
663                 </varlistentry>
664                 
665                 
666                 <varlistentry>
667                 <term>exit</term>
668                 <listitem><para>Terminate the connection with the server and exit 
669                 from the program. </para></listitem> 
670                 </varlistentry>
671                 
672                 
673                 <varlistentry>
674                 <term>get &lt;remote file name&gt; [local file name]</term>
675                 <listitem><para>Copy the file called <filename>remote file name</filename> from 
676                 the server to the machine running the client. If specified, name 
677                 the local copy <filename>local file name</filename>.  Note that all transfers in 
678                 <command>smbclient</command> are binary. See also the 
679                 lowercase command. </para></listitem>
680                 </varlistentry>
681                 
682                 
683                 
684                 <varlistentry>
685                 <term>help [command]</term>
686                 <listitem><para>See the ? command above. </para></listitem>
687                 </varlistentry>
688                 
689                 
690                 <varlistentry>
691                 <term>lcd [directory name]</term>
692                 <listitem><para>If <replaceable>directory name</replaceable> is specified, the current 
693                 working directory on the local machine will be changed to 
694                 the directory specified. This operation will fail if for any 
695                 reason the specified directory is inaccessible. </para>
696                 
697                 <para>If no directory name is specified, the name of the 
698                 current working directory on the local machine will be reported. 
699                 </para></listitem>
700                 </varlistentry>
701                 
702                 
703                 <varlistentry>
704                 <term>lowercase</term>
705                 <listitem><para>Toggle lowercasing of filenames for the get and 
706                 mget commands. </para>
707                                 
708                 <para>When lowercasing is toggled ON, local filenames are converted 
709                 to lowercase when using the get and mget commands. This is
710                 often useful when copying (say) MSDOS files from a server, because 
711                 lowercase filenames are the norm on UNIX systems. </para></listitem>
712                 </varlistentry>
713                 
714                 
715                 
716                 <varlistentry>
717                 <term>ls &lt;mask&gt;</term>
718                 <listitem><para>See the dir command above. </para></listitem>
719                 </varlistentry>
720                 
721                 
722                 <varlistentry>
723                 <term>mask &lt;mask&gt;</term>
724                 <listitem><para>This command allows the user to set up a mask 
725                 which will be used during recursive operation of the mget and 
726                 mput commands. </para>
727
728                 <para>The masks specified to the mget and mput commands act as 
729                 filters for directories rather than files when recursion is 
730                 toggled ON. </para>
731                 
732                 <para>The mask specified with the mask command is necessary 
733                 to filter files within those directories. For example, if the
734                 mask specified in an mget command is "source*" and the mask 
735                 specified with the mask command is "*.c" and recursion is 
736                 toggled ON, the mget command will retrieve all files matching 
737                 "*.c" in all directories below and including all directories 
738                 matching "source*" in the current working directory. </para>
739
740                 <para>Note that the value for mask defaults to blank (equivalent 
741                 to "*") and remains so until the mask command is used to change it. 
742                 It retains the most recently specified value indefinitely. To 
743                 avoid unexpected results it would be wise to change the value of 
744                 mask back to "*" after using the mget or mput commands. </para></listitem>
745                 </varlistentry>
746                 
747                 
748                 <varlistentry>
749                 <term>md &lt;directory name&gt;</term>
750                 <listitem><para>See the mkdir command. </para></listitem>
751                 </varlistentry>
752                 
753                 
754                 <varlistentry>
755                 <term>mget &lt;mask&gt;</term>
756                 <listitem><para>Copy all files matching <replaceable>mask</replaceable> from the server to 
757                 the machine running the client. </para>
758
759                 <para>Note that <replaceable>mask</replaceable> is interpreted differently during recursive 
760                 operation and non-recursive operation - refer to the recurse and 
761                 mask commands for more information. Note that all transfers in 
762                 <command>smbclient</command> are binary. See also the lowercase command. </para></listitem>
763                 </varlistentry>
764                 
765                 
766                 <varlistentry>
767                 <term>mkdir &lt;directory name&gt;</term>
768                 <listitem><para>Create a new directory on the server (user access 
769                 privileges permitting) with the specified name. </para></listitem>
770                 </varlistentry>
771                 
772                 
773                 <varlistentry>
774                 <term>mput &lt;mask&gt;</term>
775                 <listitem><para>Copy all files matching <replaceable>mask</replaceable> in the current working 
776                 directory on the local machine to the current working directory on 
777                 the server. </para>
778                 
779                 <para>Note that <replaceable>mask</replaceable> is interpreted differently during recursive 
780                 operation and non-recursive operation - refer to the recurse and mask 
781                 commands for more information. Note that all transfers in <command>smbclient</command> 
782                 are binary. </para></listitem>
783                 </varlistentry>
784                 
785                 
786                 <varlistentry>
787                 <term>print &lt;file name&gt;</term>
788                 <listitem><para>Print the specified file from the local machine 
789                 through a printable service on the server. </para>
790
791                 <para>See also the printmode command.</para></listitem>
792                 </varlistentry>
793                 
794                 
795                 
796                 <varlistentry>
797                 <term>printmode &lt;graphics or text&gt;</term>
798                 <listitem><para>Set the print mode to suit either binary data 
799                 (such as graphical information) or text. Subsequent print
800                 commands will use the currently set print mode. </para></listitem>
801                 </varlistentry>
802                 
803                 
804                 <varlistentry>
805                 <term>prompt</term>
806                 <listitem><para>Toggle prompting for filenames during operation 
807                 of the mget and mput commands. </para>
808
809                 <para>When toggled ON, the user will be prompted to confirm 
810                 the transfer of each file during these commands. When toggled 
811                 OFF, all specified files will be transferred without prompting. 
812                 </para></listitem>
813                 </varlistentry>
814                 
815                 
816                 <varlistentry>
817                 <term>put &lt;local file name&gt; [remote file name]</term>
818                 <listitem><para>Copy the file called <filename>local file name</filename> from the 
819                 machine running the client to the server. If specified,
820                 name the remote copy <filename>remote file name</filename>. Note that all transfers 
821                 in <command>smbclient</command> are binary. See also the lowercase command. 
822                 </para></listitem>
823                 </varlistentry>
824                 
825                 
826                 
827                 <varlistentry>
828                 <term>queue</term>
829                 <listitem><para>Displays the print queue, showing the job id, 
830                 name, size and current status. </para></listitem>
831                 </varlistentry>
832                 
833                 
834                 <varlistentry>
835                 <term>quit</term>
836                 <listitem><para>See the exit command. </para></listitem>
837                 </varlistentry>
838                 
839                 
840                 <varlistentry>
841                 <term>rd &lt;directory name&gt;</term>
842                 <listitem><para>See the rmdir command. </para></listitem>
843                 </varlistentry>
844                 
845                 
846                 <varlistentry>
847                 <term>recurse</term>
848                 <listitem><para>Toggle directory recursion for the commands mget 
849                 and mput. </para>
850                 
851                 <para>When toggled ON, these commands will process all directories 
852                 in the source directory (i.e., the directory they are copying
853                 from ) and will recurse into any that match the mask specified 
854                 to the command. Only files that match the mask specified using 
855                 the mask command will be retrieved. See also the mask command. 
856                 </para>
857
858                 <para>When recursion is toggled OFF, only files from the current 
859                 working directory on the source machine that match the mask specified 
860                 to the mget or mput commands will be copied, and any mask specified 
861                 using the mask command will be ignored. </para></listitem>
862                 </varlistentry>
863                 
864                 
865                 
866                 <varlistentry>
867                 <term>rm &lt;mask&gt;</term>
868                 <listitem><para>Remove all files matching <replaceable>mask</replaceable> from the current 
869                 working directory on the server. </para></listitem>
870                 </varlistentry>
871                 
872                 
873                 <varlistentry>
874                 <term>rmdir &lt;directory name&gt;</term>
875                 <listitem><para>Remove the specified directory (user access 
876                 privileges permitting) from the server. </para></listitem>
877                 </varlistentry>
878                 
879                 
880                 <varlistentry>
881                 <term>tar &lt;c|x&gt;[IXbgNa]</term>
882                 <listitem><para>Performs a tar operation - see the <parameter>-T
883                 </parameter> command line option above. Behavior may be affected 
884                 by the tarmode command (see below). Using g (incremental) and N 
885                 (newer) will affect tarmode settings. Note that using the "-" option 
886                 with tar x may not work - use the command line option instead. 
887                 </para></listitem>
888                 </varlistentry>
889                 
890                 
891                 <varlistentry>
892                 <term>blocksize &lt;blocksize&gt;</term>
893                 <listitem><para>Blocksize. Must be followed by a valid (greater 
894                 than zero) blocksize. Causes tar file to be written out in 
895                 <replaceable>blocksize</replaceable>*TBLOCK (usually 512 byte) blocks. </para></listitem>
896                 </varlistentry>
897                 
898                 
899                 <varlistentry>
900                 <term>tarmode &lt;full|inc|reset|noreset&gt;</term>
901                 <listitem><para>Changes tar's behavior with regard to archive 
902                 bits. In full mode, tar will back up everything regardless of the 
903                 archive bit setting (this is the default mode). In incremental mode, 
904                 tar will only back up files with the archive bit set. In reset mode, 
905                 tar will reset the archive bit on all files it backs up (implies 
906                 read/write share). </para></listitem>
907                 </varlistentry>
908                 
909                 
910                 <varlistentry>
911                 <term>setmode &lt;filename&gt; &lt;perm=[+|\-]rsha&gt;</term>
912                 <listitem><para>A version of the DOS attrib command to set 
913                 file permissions. For example: </para>
914
915                 <para><command>setmode myfile +r </command></para>
916                 
917                 <para>would make myfile read only. </para></listitem>
918                 </varlistentry>
919                 
920         </variablelist>
921 </refsect1>
922
923 <refsect1>
924         <title>NOTES</title>
925
926         <para>Some servers are fussy about the case of supplied usernames, 
927         passwords, share names (AKA service names) and machine names. 
928         If you fail to connect try giving all parameters in uppercase. 
929         </para>
930         
931         <para>It is often necessary to use the -n option when connecting 
932         to some types of servers. For example OS/2 LanManager insists 
933         on a valid NetBIOS name being used, so you need to supply a valid 
934         name that would be known to the server.</para>
935
936         <para>smbclient supports long file names where the server 
937         supports the LANMAN2 protocol or above. </para>
938 </refsect1>
939
940 <refsect1>
941         <title>ENVIRONMENT VARIABLES</title>
942
943         <para>The variable <envar>USER</envar> may contain the 
944         username of the person  using the client. This information is 
945         used only if the protocol  level is high enough to support 
946         session-level passwords.</para>
947
948
949         <para>The variable <envar>PASSWD</envar> may contain 
950         the password of the person using the client.  This information is 
951         used only if the protocol level is high enough to support 
952         session-level passwords. </para>
953
954         <para>The variable <envar>LIBSMB_PROG</envar> may contain 
955         the path, executed with system(), which the client should connect 
956         to instead of connecting to a server.  This functionality is primarily
957         intended as a development aid, and works best when using a LMHOSTS 
958         file</para>
959 </refsect1>
960
961
962 <refsect1>
963         <title>INSTALLATION</title>
964
965         <para>The location of the client program is a matter for 
966         individual system administrators. The following are thus
967         suggestions only. </para>
968
969         <para>It is recommended that the smbclient software be installed
970         in the <filename>/usr/local/samba/bin/</filename> or <filename>
971         /usr/samba/bin/</filename> directory, this directory readable 
972         by all, writeable only by root. The client program itself should 
973         be executable by all. The client should <emphasis>NOT</emphasis> be 
974         setuid or setgid! </para>
975
976         <para>The client log files should be put in a directory readable 
977         and writeable only by the user. </para>
978
979         <para>To test the client, you will need to know the name of a 
980         running SMB/CIFS server. It is possible to run <command>smbd(8)
981         </command> as an ordinary user - running that server as a daemon 
982         on a user-accessible port (typically any port number over 1024)
983         would provide a suitable test server. </para>
984 </refsect1>
985
986
987 <refsect1>
988         <title>DIAGNOSTICS</title>
989
990         <para>Most diagnostics issued by the client are logged in a 
991         specified log file. The log file name is specified at compile time, 
992         but may be overridden on the command line. </para>
993
994         <para>The number and nature of diagnostics available depends 
995         on the debug level used by the client. If you have problems, 
996         set the debug level to 3 and peruse the log files. </para>
997 </refsect1>
998
999
1000 <refsect1>
1001         <title>VERSION</title>
1002
1003         <para>This man page is correct for version 2.2 of 
1004         the Samba suite.</para>
1005 </refsect1>
1006
1007
1008 <refsect1>
1009         <title>AUTHOR</title>
1010         
1011         <para>The original Samba software and related utilities 
1012         were created by Andrew Tridgell. Samba is now developed
1013         by the Samba Team as an Open Source project similar 
1014         to the way the Linux kernel is developed.</para>
1015         
1016         <para>The original Samba man pages were written by Karl Auer. 
1017         The man page sources were converted to YODL format (another 
1018         excellent piece of Open Source software, available at
1019         <ulink url="ftp://ftp.icce.rug.nl/pub/unix/">
1020         ftp://ftp.icce.rug.nl/pub/unix/</ulink>) and updated for the Samba 2.0 
1021         release by Jeremy Allison.  The conversion to DocBook for 
1022         Samba 2.2 was done by Gerald Carter</para>
1023 </refsect1>
1024
1025 </refentry>