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