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