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