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