first pass at updating head branch to be to be the same as the SAMBA_2_0 branch
[sfrench/samba-autobuild/.git] / docs / manpages / smbclient.1
1 .TH "smbclient " "1" "23 Oct 1998" "Samba" "SAMBA" 
2 .PP 
3 .SH "NAME" 
4 smbclient \- ftp-like client to access SMB/CIFS resources on servers
5 .PP 
6 .SH "SYNOPSIS" 
7 .PP 
8 \fBsmbclient\fP servicename [-s smb\&.conf] [-O socket options][-R name resolve order] [-M NetBIOS name] [-i scope] [-N] [-n NetBIOS name] [-d debuglevel] [-P] [-p port] [-l log basename] [-h] [-I dest IP] [-E] [-U username] [-L NetBIOS name] [-t terminal code] [-m max protocol] [-b buffersize] [-W workgroup] [-T<c|x>IXFqgbNan] [-D directory] [-c command string]
9 .PP 
10 .SH "DESCRIPTION" 
11 .PP 
12 This program is part of the \fBSamba\fP suite\&.
13 .PP 
14 \fBsmbclient\fP is a client that can \'talk\' to an SMB/CIFS server\&. It
15 offers an interface similar to that of the ftp program (see \fBftp
16 (1)\fP)\&.  Operations include things like getting files from the server
17 to the local machine, putting files from the local machine to the
18 server, retrieving directory information from the server and so on\&.
19 .PP 
20 .SH "OPTIONS" 
21 .PP 
22 .IP 
23 .IP "\fBservicename\fP" 
24 servicename is the name of the service you want
25 to use on the server\&. A service name takes the form
26 \f(CW//server/service\fP where \fIserver\fP is the NetBIOS name of the SMB/CIFS
27 server offering the desired service and \fIservice\fP is the name
28 of the service offered\&. Thus to connect to the service \fIprinter\fP on
29 the SMB/CIFS server \fIsmbserver\fP, you would use the servicename
30 .IP 
31 \f(CW//smbserver/printer\fP
32 .IP 
33 Note that the server name required is NOT necessarily the IP (DNS)
34 host name of the server ! The name required is a NetBIOS server name,
35 which may or may not be the same as the IP hostname of the machine
36 running the server\&.
37 .IP 
38 The server name is looked up according to either the
39 \fB-R\fP parameter to \fBsmbclient\fP or using the
40 \fBname resolve order\fP
41 parameter in the smb\&.conf file, allowing an administrator to change
42 the order and methods by which server names are looked up\&.
43 .IP 
44 .IP "\fBpassword\fP" 
45 password is the password required to access the
46 specified service on the specified server\&. If this parameter is
47 supplied, the \fB-N\fP option (suppress password prompt) is assumed\&.
48 .IP 
49 There is no default password\&. If no password is supplied on the
50 command line (either by using this parameter or adding a password to
51 the \fB-U\fP option (see below)) and the \fB-N\fP option is not specified,
52 the client will prompt for a password, even if the desired service
53 does not require one\&. (If no password is required, simply press ENTER
54 to provide a null password\&.)
55 .IP 
56 Note: Some servers (including OS/2 and Windows for Workgroups) insist
57 on an uppercase password\&. Lowercase or mixed case passwords may be
58 rejected by these servers\&.
59 .IP 
60 Be cautious about including passwords in scripts\&.
61 .IP 
62 .IP "\fB-s smb\&.conf\fP" 
63 This parameter specifies the pathname to the
64 Samba configuration file, smb\&.conf\&. This file controls all aspects of
65 the Samba setup on the machine and smbclient also needs to read this
66 file\&.
67 .IP 
68 .IP "\fB-O socket options\fP" 
69 TCP socket options to set on the client
70 socket\&. See the socket options
71 parameter in the \fBsmb\&.conf (5)\fP manpage for
72 the list of valid options\&.
73 .IP 
74 .IP "\fB-R name resolve order\fP" 
75 This option allows the user of
76 smbclient to determine what name resolution services to use when
77 looking up the NetBIOS name of the host being connected to\&.
78 .IP 
79 The options are :"lmhosts", "host", "wins" and "bcast"\&. They cause
80 names to be resolved as follows :
81 .IP 
82 .IP 
83 .IP o 
84 \fBlmhosts\fP : Lookup an IP address in the Samba lmhosts file\&.
85 The lmhosts file is stored in the same directory as the
86 \fBsmb\&.conf\fP file\&.
87 .IP 
88 .IP o 
89 \fBhost\fP : Do a standard host name to IP address resolution,
90 using the system /etc/hosts, NIS, or DNS lookups\&. This method of name
91 resolution is operating system depended for instance on IRIX or
92 Solaris this may be controlled by the \fI/etc/nsswitch\&.conf\fP file)\&.  
93 .IP 
94 .IP o 
95 \fBwins\fP : Query a name with the IP address listed in the \fBwins
96 server\fP parameter in the smb\&.conf file\&. If 
97 no WINS server has been specified this method will be ignored\&.
98 .IP 
99 .IP o 
100 \fBbcast\fP : Do a broadcast on each of the known local interfaces
101 listed in the \fBinterfaces\fP parameter
102 in the smb\&.conf file\&. This is the least reliable of the name resolution
103 methods as it depends on the target host being on a locally connected
104 subnet\&. 
105 .IP 
106 .IP 
107 If this parameter is not set then the name resolve order defined
108 in the \fBsmb\&.conf\fP file parameter 
109 (\fBname resolve order\fP)
110 will be used\&.
111 .IP 
112 The default order is lmhosts, host, wins, bcast and without this
113 parameter or any entry in the \fB"name resolve
114 order"\fP parameter of the
115 \fBsmb\&.conf\fP file the name resolution methods
116 will be attempted in this order\&.
117 .IP 
118 .IP "\fB-M NetBIOS name\fP" 
119 This options allows you to send messages,
120 using the "WinPopup" protocol, to another computer\&. Once a connection
121 is established you then type your message, pressing ^D (control-D) to
122 end\&.
123 .IP 
124 If the receiving computer is running WinPopup the user will receive
125 the message and probably a beep\&. If they are not running WinPopup the
126 message will be lost, and no error message will occur\&.
127 .IP 
128 The message is also automatically truncated if the message is over
129 1600 bytes, as this is the limit of the protocol\&.
130 .IP 
131 One useful trick is to cat the message through \fBsmbclient\fP\&.
132 For example:
133 .IP 
134 \f(CWcat mymessage\&.txt | smbclient -M FRED\fP
135 .IP 
136 will send the message in the file \fImymessage\&.txt\fP to the machine FRED\&.
137 .IP 
138 You may also find the \fB-U\fP and \fB-I\fP options useful, as they allow
139 you to control the FROM and TO parts of the message\&.
140 .IP 
141 See the \fBmessage command\fP
142 parameter in the \fBsmb\&.conf (5)\fP for a description of how to handle
143 incoming WinPopup messages in Samba\&.
144 .IP 
145 Note: Copy WinPopup into the startup group on your WfWg PCs if you
146 want them to always be able to receive messages\&.
147 .IP 
148 .IP "\fB-i scope\fP" 
149 This specifies a NetBIOS scope that smbclient will use
150 to communicate with when generating NetBIOS names\&. For details on the
151 use of NetBIOS scopes, see rfc1001\&.txt and rfc1002\&.txt\&. NetBIOS scopes
152 are \fIvery\fP rarely used, only set this parameter if you are the
153 system administrator in charge of all the NetBIOS systems you
154 communicate with\&.
155 .IP 
156 .IP "\fB-N\fP" 
157 If specified, this parameter suppresses the normal
158 password prompt from the client to the user\&. This is useful when
159 accessing a service that does not require a password\&.
160 .IP 
161 Unless a password is specified on the command line or this parameter
162 is specified, the client will request a password\&.
163 .IP 
164 .IP "\fB-n NetBIOS name\fP" 
165 By default, the client will use the local
166 machine\'s hostname (in uppercase) as its NetBIOS name\&. This parameter
167 allows you to override the host name and use whatever NetBIOS name you
168 wish\&.
169 .IP 
170 .IP "\fB-d debuglevel\fP" 
171 debuglevel is an integer from 0 to 10, or the
172 letter \'A\'\&.
173 .IP 
174 The default value if this parameter is not specified is zero\&.
175 .IP 
176 The higher this value, the more detail will be logged to the log files
177 about the activities of the client\&. At level 0, only critical errors
178 and serious warnings will be logged\&. Level 1 is a reasonable level for
179 day to day running - it generates a small amount of information about
180 operations carried out\&.
181 .IP 
182 Levels above 1 will generate considerable amounts of log data, and
183 should only be used when investigating a problem\&. Levels above 3 are
184 designed for use only by developers and generate HUGE amounts of log
185 data, most of which is extremely cryptic\&. If debuglevel is set to the
186 letter \'A\', then \fIall\fP debug messages will be printed\&. This setting
187 is for developers only (and people who \fIreally\fP want to know how the
188 code works internally)\&.
189 .IP 
190 Note that specifying this parameter here will override the \fBlog
191 level\fP parameter in the \fBsmb\&.conf
192 (5)\fP file\&.
193 .IP 
194 .IP "\fB-P\fP" 
195 This option is no longer used\&. The code in Samba2\&.0
196 now lets the server decide the device type, so no printer specific
197 flag is needed\&.
198 .IP 
199 .IP "\fB-p port\fP" 
200 This number is the TCP port number that will be used
201 when making connections to the server\&. The standard (well-known) TCP
202 port number for an SMB/CIFS server is 139, which is the default\&.
203 .IP 
204 .IP "\fB-l logfilename\fP" 
205 If specified, logfilename specifies a base
206 filename into which operational data from the running client will be
207 logged\&.
208 .IP 
209 The default base name is specified at compile time\&.
210 .IP 
211 The base name is used to generate actual log file names\&. For example,
212 if the name specified was "log", the debug file would be
213 \f(CWlog\&.client\fP\&.
214 .IP 
215 The log file generated is never removed by the client\&.
216 .IP 
217 .IP "\fB-h\fP" 
218 Print the usage message for the client\&.
219 .IP 
220 .IP "\fB-I IP address\fP" 
221 IP address is the address of the server to
222 connect to\&. It should be specified in standard "a\&.b\&.c\&.d" notation\&.
223 .IP 
224 Normally the client would attempt to locate a named SMB/CIFS server by
225 looking it up via the NetBIOS name resolution mechanism described
226 above in the \fBname resolve order\fP parameter
227 above\&. Using this parameter will force the client to assume that the
228 server is on the machine with the specified IP address and the NetBIOS
229 name component of the resource being connected to will be ignored\&.
230 .IP 
231 There is no default for this parameter\&. If not supplied, it will be
232 determined automatically by the client as described above\&.
233 .IP 
234 .IP "\fB-E\fP" 
235 This parameter causes the client to write messages to the
236 standard error stream (stderr) rather than to the standard output
237 stream\&.
238 .IP 
239 By default, the client writes messages to standard output - typically
240 the user\'s tty\&.
241 .IP 
242 .IP "\fB-U username\fP" 
243 This specifies the user name that will be used by
244 the client to make a connection, assuming your server is not a downlevel
245 server that is running a protocol level that uses passwords on shares,
246 not on usernames\&.
247 .IP 
248 Some servers are fussy about the case of this name, and some insist
249 that it must be a valid NetBIOS name\&.
250 .IP 
251 If no username is supplied, it will default to an uppercase version of
252 the environment variable \f(CWUSER\fP or \f(CWLOGNAME\fP in that order\&.  If no
253 username is supplied and neither environment variable exists the
254 username "GUEST" will be used\&.
255 .IP 
256 If the \f(CWUSER\fP environment variable contains a \'%\' character,
257 everything after that will be treated as a password\&. This allows you
258 to set the environment variable to be \f(CWUSER=username%password\fP so
259 that a password is not passed on the command line (where it may be
260 seen by the ps command)\&.
261 .IP 
262 If the service you are connecting to requires a password, it can be
263 supplied using the \fB-U\fP option, by appending a percent symbol ("%")
264 then the password to username\&.  For example, to attach to a service as
265 user \f(CW"fred"\fP with password \f(CW"secret"\fP, you would specify\&. 
266 .br 
267 .IP 
268 \f(CW-U fred%secret\fP 
269 .br 
270 .IP 
271 on the command line\&. Note that there are no spaces around the percent
272 symbol\&.
273 .IP 
274 If you specify the password as part of username then the \fB-N\fP option
275 (suppress password prompt) is assumed\&.
276 .IP 
277 If you specify the password as a parameter \fIAND\fP as part of username
278 then the password as part of username will take precedence\&. Putting
279 nothing before or nothing after the percent symbol will cause an empty
280 username or an empty password to be used, respectively\&.
281 .IP 
282 The password may also be specified by setting up an environment
283 variable called \f(CWPASSWD\fP that contains the users password\&. Note
284 that this may be very insecure on some systems but on others allows
285 users to script smbclient commands without having a password appear in
286 the command line of a process listing\&.
287 .IP 
288 Note: Some servers (including OS/2 and Windows for Workgroups) insist
289 on an uppercase password\&. Lowercase or mixed case passwords may be
290 rejected by these servers\&.
291 .IP 
292 Be cautious about including passwords in scripts or in the
293 \f(CWPASSWD\fP environment variable\&. Also, on many systems the command
294 line of a running process may be seen via the \f(CWps\fP command to be
295 safe always allow smbclient to prompt for a password and type it in
296 directly\&.
297 .IP 
298 .IP "\fB-L\fP" 
299 This option allows you to look at what services are
300 available on a server\&. You use it as \f(CW"smbclient -L host"\fP and a
301 list should appear\&.  The \fB-I\fP option may be useful if your NetBIOS
302 names don\'t match your tcp/ip dns host names or if you are trying to
303 reach a host on another network\&.
304 .IP 
305 .IP "\fB-t terminal code\fP" 
306 This option tells smbclient how to interpret
307 filenames coming from the remote server\&. Usually Asian language
308 multibyte UNIX implementations use different character sets than
309 SMB/CIFS servers (\fIEUC\fP instead of \fISJIS\fP for example)\&. Setting
310 this parameter will let smbclient convert between the UNIX filenames
311 and the SMB filenames correctly\&. This option has not been seriously
312 tested and may have some problems\&.
313 .IP 
314 The terminal codes include \f(CWsjis\fP, \f(CWeuc\fP, \f(CWjis7\fP, \f(CWjis8\fP,
315 \f(CWjunet\fP, \f(CWhex\fP, \f(CWcap\fP\&. This is not a complete list, check the
316 Samba source code for the complete list\&.
317 .IP 
318 .IP "\fB-m max protocol level\fP" 
319 With the new code in Samba2\&.0,
320 \fBsmbclient\fP always attempts to connect at the maximum
321 protocols level the server supports\&. This parameter is
322 preserved for backwards compatibility, but any string
323 following the \fB-m\fP will be ignored\&.
324 .IP 
325 .IP "\fB-b buffersize\fP" 
326 This option changes the transmit/send buffer
327 size when getting or putting a file from/to the server\&. The default
328 is 65520 bytes\&. Setting this value smaller (to 1200 bytes) has been
329 observed to speed up file transfers to and from a Win9x server\&.
330 .IP 
331 .IP "\fB-W WORKGROUP\fP" 
332 Override the default workgroup specified in the
333 \fBworkgroup\fP parameter of the
334 \fBsmb\&.conf\fP file for this connection\&. This may
335 be needed to connect to some servers\&.
336 .IP 
337 .IP "\fB-T tar options\fP" 
338 smbclient may be used to create
339 \fBtar (1)\fP compatible backups of all the files on an SMB/CIFS
340 share\&. The secondary tar flags that can be given to this option are :
341 .IP 
342 .IP 
343 .IP "\fBc\fP" 
344 Create a tar file on UNIX\&. Must be followed by the
345 name of a tar file, tape device or \f(CW"-"\fP for standard output\&. If
346 using standard output you must turn the log level to its lowest value
347 \f(CW-d0\fP to avoid corrupting your tar file\&. This flag is
348 mutually exclusive with the \fBx\fP flag\&.
349 .IP 
350 .IP "\fBx\fP" 
351 Extract (restore) a local tar file back to a
352 share\&. Unless the \fB-D\fP option is given, the tar files will be
353 restored from the top level of the share\&. Must be followed by the name
354 of the tar file, device or \f(CW"-"\fP for standard input\&. Mutually exclusive
355 with the \fBc\fP flag\&. Restored files have their creation times (mtime)
356 set to the date saved in the tar file\&. Directories currently do not
357 get their creation dates restored properly\&.
358 .IP 
359 .IP "\fBI\fP" 
360 Include files and directories\&. Is the default
361 behavior when filenames are specified above\&. Causes tar files to
362 be included in an extract or create (and therefore everything else to
363 be excluded)\&. See example below\&.  Filename globbing works 
364 in one of two ways\&.  See \fBr\fP below\&.
365 .IP 
366 .IP "\fBX\fP" 
367 Exclude files and directories\&. Causes tar files to
368 be excluded from an extract or create\&. See example below\&.  Filename
369 globbing works in one of two ways now\&. See \fBr\fP below\&.
370 .IP 
371 .IP "\fBb\fP" 
372 Blocksize\&. Must be followed by a valid (greater than
373 zero) blocksize\&.  Causes tar file to be written out in
374 blocksize*TBLOCK (usually 512 byte) blocks\&.
375 .IP 
376 .IP "\fBg\fP" 
377 Incremental\&. Only back up files that have the
378 archive bit set\&. Useful only with the \fBc\fP flag\&.
379 .IP 
380 .IP "\fBq\fP" 
381 Quiet\&. Keeps tar from printing diagnostics as it
382 works\&.  This is the same as tarmode quiet\&.
383 .IP 
384 .IP "\fBr\fP" 
385 Regular expression include or exclude\&.  Uses regular 
386 regular expression matching for excluding or excluding files if 
387 compiled with HAVE_REGEX_H\&. However this mode can be very slow\&. If 
388 not compiled with HAVE_REGEX_H, does a limited wildcard match on * and 
389 ?\&.
390 .IP 
391 .IP "\fBN\fP" 
392 Newer than\&. Must be followed by the name of a file
393 whose date is compared against files found on the share during a
394 create\&. Only files newer than the file specified are backed up to the
395 tar file\&. Useful only with the \fBc\fP flag\&.
396 .IP 
397 .IP "\fBa\fP" 
398 Set archive bit\&. Causes the archive bit to be reset
399 when a file is backed up\&. Useful with the \fBg\fP and \fBc\fP flags\&.
400 .IP 
401 .IP 
402 \fITar Long File Names\fP
403 .IP 
404 smbclient\'s tar option now supports long file names both on backup and
405 restore\&. However, the full path name of the file must be less than
406 1024 bytes\&.  Also, when a tar archive is created, smbclient\'s tar
407 option places all files in the archive with relative names, not
408 absolute names\&.
409 .IP 
410 \fITar Filenames\fP
411 .IP 
412 All file names can be given as DOS path names (with \f(CW\e\fP as the
413 component separator) or as UNIX path names (with \f(CW/\fP as the
414 component separator)\&.
415 .IP 
416 \fIExamples\fP
417 .IP 
418 .IP 
419 .IP o 
420 Restore from tar file backup\&.tar into myshare on mypc (no password on share)\&.
421 .IP 
422 \f(CWsmbclient //mypc/myshare "" -N -Tx backup\&.tar\fP
423 .IP 
424 .IP o 
425 Restore everything except users/docs
426 .IP 
427 \f(CWsmbclient //mypc/myshare "" -N -TXx backup\&.tar users/docs\fP
428 .IP 
429 .IP o 
430 Create a tar file of the files beneath users/docs\&.
431 .IP 
432 \f(CWsmbclient //mypc/myshare "" -N -Tc backup\&.tar users/docs\fP
433 .IP 
434 .IP o 
435 Create the same tar file as above, but now use a DOS path name\&.
436 .IP 
437 \f(CWsmbclient //mypc/myshare "" -N -tc backup\&.tar users\eedocs\fP
438 .IP 
439 .IP o 
440 Create a tar file of all the files and directories in the share\&.
441 .IP 
442 \f(CWsmbclient //mypc/myshare "" -N -Tc backup\&.tar *\fP
443 .IP 
444 .IP 
445 .IP "\fB-D initial directory\fP" 
446 Change to initial directory before
447 starting\&. Probably only of any use with the tar \fB-T\fP option\&.
448 .IP 
449 .IP "\fB-c command string\fP" 
450 command string is a semicolon separated
451 list of commands to be executed instead of prompting from stdin\&.
452 \fB-N\fP is implied by \fB-c\fP\&.
453 .IP 
454 This is particularly useful in scripts and for printing stdin to the
455 server, e\&.g\&. \f(CW-c \'print -\'\fP\&.
456 .IP 
457 .PP 
458 .SH "OPERATIONS" 
459 .PP 
460 Once the client is running, the user is presented with a prompt :
461 .PP 
462 \f(CWsmb:\e>\fP
463 .PP 
464 The backslash ("\e") indicates the current working directory on the
465 server, and will change if the current working directory is changed\&.
466 .PP 
467 The prompt indicates that the client is ready and waiting to carry out
468 a user command\&. Each command is a single word, optionally followed by
469 parameters specific to that command\&. Command and parameters are
470 space-delimited unless these notes specifically state otherwise\&. All
471 commands are case-insensitive\&.  Parameters to commands may or may not
472 be case sensitive, depending on the command\&.
473 .PP 
474 You can specify file names which have spaces in them by quoting the
475 name with double quotes, for example "a long file name"\&.
476 .PP 
477 Parameters shown in square brackets (e\&.g\&., "[parameter]") are
478 optional\&. If not given, the command will use suitable
479 defaults\&. Parameters shown in angle brackets (e\&.g\&., "<parameter>") are
480 required\&.
481 .PP 
482 Note that all commands operating on the server are actually performed
483 by issuing a request to the server\&. Thus the behavior may vary from
484 server to server, depending on how the server was implemented\&.
485 .PP 
486 The commands available are given here in alphabetical order\&.
487 .PP 
488 .IP 
489 .IP "\fB? [command]\fP" 
490 If "command" is specified,
491 the \fB?\fP command will display a brief informative message about the
492 specified command\&.  If no command is specified, a list of available
493 commands will be displayed\&.
494 .IP 
495 .IP "\fB! [shell command]\fP" 
496 If "shell command"
497 is specified, the \fB!\fP  command will execute a shell locally and run
498 the specified shell command\&. If no command is specified, a local shell
499 will be run\&.
500 .IP 
501 .IP "\fBcd [directory name]\fP" 
502 If "directory name" is
503 specified, the current working directory on the server will be changed
504 to the directory specified\&. This operation will fail if for any reason
505 the specified directory is inaccessible\&.
506 .IP 
507 If no directory name is specified, the current working directory on
508 the server will be reported\&.
509 .IP 
510 .IP "\fBdel <mask>\fP" 
511 The client will request that the server
512 attempt to delete all files matching "mask" from the current working
513 directory on the server\&.
514 .IP 
515 .IP "\fBdir <mask>\fP" 
516 A list of the files matching "mask" in
517 the current working directory on the server will be retrieved from the
518 server and displayed\&.
519 .IP 
520 .IP "\fBexit\fP" 
521 Terminate the connection with the server and
522 exit from the program\&.
523 .IP 
524 .IP "\fBget <remote file name> [local file name]\fP" 
525 Copy the
526 file called "remote file name" from the server to the machine running
527 the client\&. If specified, name the local copy "local file name"\&.  Note
528 that all transfers in smbclient are binary\&. See also the
529 \fBlowercase\fP command\&.
530 .IP 
531 .IP "\fBhelp [command]\fP" 
532 See the \fB?\fP
533 command above\&.
534 .IP 
535 .IP "\fBlcd [directory name]\fP" 
536 If "directory name" is
537 specified, the current working directory on the local machine will
538 be changed to the directory specified\&. This operation will fail if for
539 any reason the specified directory is inaccessible\&.
540 .IP 
541 If no directory name is specified, the name of the current working
542 directory on the local machine will be reported\&.
543 .IP 
544 .IP "\fBlowercase\fP" 
545 Toggle lowercasing of filenames
546 for the \fBget\fP and \fBmget\fP commands\&.
547 .IP 
548 When lowercasing is toggled ON, local filenames are converted to
549 lowercase when using the \fBget\fP and \fBmget\fP
550 commands\&. This is often useful when copying (say) MSDOS files from a
551 server, because lowercase filenames are the norm on UNIX systems\&.
552 .IP 
553 .IP "\fBls <mask>\fP" 
554 See the \fBdir\fP command above\&.
555 .IP 
556 .IP "\fBmask <mask>\fP" 
557 This command allows the user to set
558 up a mask which will be used during recursive operation of the
559 \fBmget\fP and \fBmput\fP commands\&.
560 .IP 
561 The masks specified to the \fBmget\fP and
562 \fBmput\fP commands act as filters for directories rather
563 than files when recursion is toggled ON\&.
564 .IP 
565 The mask specified with the \&.B mask command is necessary to filter
566 files within those directories\&. For example, if the mask specified in
567 an \fBmget\fP command is "source*" and the mask specified
568 with the mask command is "*\&.c" and recursion is toggled ON, the
569 \fBmget\fP command will retrieve all files matching "*\&.c" in
570 all directories below and including all directories matching "source*"
571 in the current working directory\&.
572 .IP 
573 Note that the value for mask defaults to blank (equivalent to "*") and
574 remains so until the mask command is used to change it\&. It retains the
575 most recently specified value indefinitely\&. To avoid unexpected
576 results it would be wise to change the value of \&.I mask back to "*"
577 after using the \fBmget\fP or \fBmput\fP commands\&.
578 .IP 
579 .IP "\fBmd <directory name>\fP" 
580 See the \fBmkdir\fP
581 command\&.
582 .IP 
583 .IP "\fBmget <mask>\fP" 
584 Copy all files matching mask from the
585 server to the machine running the client\&.
586 .IP 
587 Note that mask is interpreted differently during recursive operation
588 and non-recursive operation - refer to the \fBrecurse\fP
589 and \fBmask\fP commands for more information\&. Note that all
590 transfers in \&.B smbclient are binary\&. See also the
591 \fBlowercase\fP command\&.
592 .IP 
593 .IP "\fBmkdir <directory name>\fP" 
594 Create a new directory on
595 the server (user access privileges permitting) with the specified
596 name\&.
597 .IP 
598 .IP "\fBmput <mask>\fP" 
599 Copy all files matching mask in
600 the current working directory on the local machine to the current
601 working directory on the server\&.
602 .IP 
603 Note that mask is interpreted differently during recursive operation
604 and non-recursive operation - refer to the \fBrecurse\fP
605 and \fBmask\fP commands for more information\&. Note that all
606 transfers in \&.B smbclient are binary\&.
607 .IP 
608 .IP "\fBprint <file name>\fP" 
609 Print the specified file
610 from the local machine through a printable service on the server\&.
611 .IP 
612 See also the \fBprintmode\fP command\&.
613 .IP 
614 .IP "\fBprintmode <graphics or text>\fP" 
615 Set the print
616 mode to suit either binary data (such as graphical information) or
617 text\&. Subsequent print commands will use the currently set print
618 mode\&.
619 .IP 
620 .IP "\fBprompt\fP" 
621 Toggle prompting for filenames during
622 operation of the \fBmget\fP and \fBmput\fP
623 commands\&.
624 .IP 
625 When toggled ON, the user will be prompted to confirm the transfer of
626 each file during these commands\&. When toggled OFF, all specified files
627 will be transferred without prompting\&.
628 .IP 
629 .IP "\fBput <local file name> [remote file name]\fP" 
630 Copy the
631 file called "local file name" from the machine running the client to
632 the server\&. If specified, name the remote copy "remote file name"\&.
633 Note that all transfers in smbclient are binary\&. See also the
634 \fBlowercase\fP command\&.
635 .IP 
636 .IP "\fBqueue\fP" 
637 Displays the print queue, showing the job
638 id, name, size and current status\&.
639 .IP 
640 .IP "\fBquit\fP" 
641 See the \fBexit\fP command\&.
642 .IP 
643 .IP "\fBrd <directory name>\fP" 
644 See the \fBrmdir\fP
645 command\&.
646 .IP 
647 .IP "\fBrecurse\fP" 
648 Toggle directory recursion for the
649 commands \fBmget\fP and \fBmput\fP\&.
650 .IP 
651 When toggled ON, these commands will process all directories in the
652 source directory (i\&.e\&., the directory they are copying \&.IR from ) and
653 will recurse into any that match the mask specified to the
654 command\&. Only files that match the mask specified using the
655 \fBmask\fP command will be retrieved\&. See also the
656 \fBmask\fP command\&.
657 .IP 
658 When recursion is toggled OFF, only files from the current working
659 directory on the source machine that match the mask specified to the
660 \fBmget\fP or \fBmput\fP commands will be copied,
661 and any mask specified using the \fBmask\fP command will be
662 ignored\&.
663 .IP 
664 .IP "\fBrm <mask>\fP" 
665 Remove all files matching mask from
666 the current working directory on the server\&.
667 .IP 
668 .IP "\fBrmdir <directory name>\fP" 
669 Remove the specified
670 directory (user access privileges permitting) from the server\&.
671 .IP 
672 .IP "\fBtar <c|x>[IXbgNa]\fP" 
673 Performs a tar operation - see
674 the \fB-T\fP command line option above\&. Behavior may be
675 affected by the \fBtarmode\fP command (see below)\&. Using
676 g (incremental) and N (newer) will affect tarmode settings\&. Note that
677 using the "-" option with tar x may not work - use the command line
678 option instead\&.
679 .IP 
680 .IP "\fBblocksize <blocksize>\fP" 
681 Blocksize\&. Must be
682 followed by a valid (greater than zero) blocksize\&. Causes tar file to
683 be written out in blocksize*TBLOCK (usually 512 byte) blocks\&.
684 .IP 
685 .IP "\fBtarmode <full|inc|reset|noreset>\fP" 
686 Changes tar\'s
687 behavior with regard to archive bits\&. In full mode, tar will back up
688 everything regardless of the archive bit setting (this is the default
689 mode)\&. In incremental mode, tar will only back up files with the
690 archive bit set\&. In reset mode, tar will reset the archive bit on all
691 files it backs up (implies read/write share)\&.
692 .IP 
693 .IP "\fBsetmode <filename> <perm=[+|\e-]rsha>\fP" 
694 A version
695 of the DOS attrib command to set file permissions\&. For example:
696 .IP 
697 \f(CWsetmode myfile +r\fP
698 .IP 
699 would make myfile read only\&.
700 .IP 
701 .PP 
702 .SH "NOTES" 
703 .PP 
704 Some servers are fussy about the case of supplied usernames,
705 passwords, share names (AKA service names) and machine names\&. If you
706 fail to connect try giving all parameters in uppercase\&.
707 .PP 
708 It is often necessary to use the \fB-n\fP option when connecting to some
709 types of servers\&. For example OS/2 LanManager insists on a valid
710 NetBIOS name being used, so you need to supply a valid name that would
711 be known to the server\&.
712 .PP 
713 smbclient supports long file names where the server supports the
714 LANMAN2 protocol or above\&.
715 .PP 
716 .SH "ENVIRONMENT VARIABLES" 
717 .PP 
718 The variable \fBUSER\fP may contain the username of the person using the
719 client\&.  This information is used only if the protocol level is high
720 enough to support session-level passwords\&.
721 .PP 
722 The variable \fBPASSWD\fP may contain the password of the person using
723 the client\&.  This information is used only if the protocol level is
724 high enough to support session-level passwords\&.
725 .PP 
726 .SH "INSTALLATION" 
727 .PP 
728 The location of the client program is a matter for individual system
729 administrators\&. The following are thus suggestions only\&.
730 .PP 
731 It is recommended that the smbclient software be installed in the
732 /usr/local/samba/bin or /usr/samba/bin directory, this directory
733 readable by all, writeable only by root\&. The client program itself
734 should be executable by all\&. The client should \fINOT\fP be setuid or
735 setgid!
736 .PP 
737 The client log files should be put in a directory readable and
738 writeable only by the user\&.
739 .PP 
740 To test the client, you will need to know the name of a running
741 SMB/CIFS server\&. It is possible to run \fBsmbd (8)\fP
742 an ordinary user - running that server as a daemon on a
743 user-accessible port (typically any port number over 1024) would
744 provide a suitable test server\&.
745 .PP 
746 .SH "DIAGNOSTICS" 
747 .PP 
748 Most diagnostics issued by the client are logged in a specified log
749 file\&. The log file name is specified at compile time, but may be
750 overridden on the command line\&.
751 .PP 
752 The number and nature of diagnostics available depends on the debug
753 level used by the client\&. If you have problems, set the debug level to
754 3 and peruse the log files\&.
755 .PP 
756 .SH "VERSION" 
757 .PP 
758 This man page is correct for version 2\&.0 of the Samba suite\&.
759 .PP 
760 .SH "AUTHOR" 
761 .PP 
762 The original Samba software and related utilities were created by
763 Andrew Tridgell \fIsamba-bugs@samba\&.org\fP\&. Samba is now developed
764 by the Samba Team as an Open Source project similar to the way the
765 Linux kernel is developed\&.
766 .PP 
767 The original Samba man pages were written by Karl Auer\&. The man page
768 sources were converted to YODL format (another excellent piece of Open
769 Source software, available at
770 \fBftp://ftp\&.icce\&.rug\&.nl/pub/unix/\fP)
771 and updated for the Samba2\&.0 release by Jeremy Allison\&.
772 \fIsamba-bugs@samba\&.org\fP\&.
773 .PP 
774 See \fBsamba (7)\fP to find out how to get a full
775 list of contributors and details on how to submit bug reports,
776 comments etc\&.