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