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