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