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