syncing up changes in 2.2
[samba.git] / docs / htmldocs / smbclient.1.html
1 <HTML
2 ><HEAD
3 ><TITLE
4 >smbclient</TITLE
5 ><META
6 NAME="GENERATOR"
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.57"></HEAD
8 ><BODY
9 CLASS="REFENTRY"
10 BGCOLOR="#FFFFFF"
11 TEXT="#000000"
12 LINK="#0000FF"
13 VLINK="#840084"
14 ALINK="#0000FF"
15 ><H1
16 ><A
17 NAME="SMBCLIENT"
18 >smbclient</A
19 ></H1
20 ><DIV
21 CLASS="REFNAMEDIV"
22 ><A
23 NAME="AEN5"
24 ></A
25 ><H2
26 >Name</H2
27 >smbclient&nbsp;--&nbsp;ftp-like client to access SMB/CIFS resources 
28         on servers</DIV
29 ><DIV
30 CLASS="REFSYNOPSISDIV"
31 ><A
32 NAME="AEN8"
33 ></A
34 ><H2
35 >Synopsis</H2
36 ><P
37 ><B
38 CLASS="COMMAND"
39 >smbclient</B
40 >  {servicename} [password] [-b &#60;buffer size&#62;] [-d debuglevel] [-D Directory] [-S server] [-U username] [-W workgroup] [-M &#60;netbios name&#62;] [-m maxprotocol] [-A authfile] [-N] [-l logfile] [-L &#60;netbios name&#62;] [-I destinationIP] [-E &#60;terminal code&#62;] [-c &#60;command string&#62;] [-i scope] [-O &#60;socket options&#62;] [-p port] [-R &#60;name resolve order&#62;] [-s &#60;smb config file&#62;] [-T&#60;c|x&#62;IXFqgbNan]</P
41 ></DIV
42 ><DIV
43 CLASS="REFSECT1"
44 ><A
45 NAME="AEN34"
46 ></A
47 ><H2
48 >DESCRIPTION</H2
49 ><P
50 >This tool is part of the <A
51 HREF="samba.7.html"
52 TARGET="_top"
53 >       Samba</A
54 > suite.</P
55 ><P
56 ><B
57 CLASS="COMMAND"
58 >smbclient</B
59 > is a client that can 
60         'talk' to an SMB/CIFS server. It offers an interface
61         similar to that of the ftp program (see <B
62 CLASS="COMMAND"
63 >ftp(1)</B
64 >).  
65         Operations include things like getting files from the server 
66         to the local machine, putting files from the local machine to 
67         the server, retrieving directory information from the server 
68         and so on. </P
69 ></DIV
70 ><DIV
71 CLASS="REFSECT1"
72 ><A
73 NAME="AEN41"
74 ></A
75 ><H2
76 >OPTIONS</H2
77 ><P
78 ></P
79 ><DIV
80 CLASS="VARIABLELIST"
81 ><DL
82 ><DT
83 >servicename</DT
84 ><DD
85 ><P
86 >servicename is the name of the service 
87                 you want to use on the server. A service name takes the form
88                 <TT
89 CLASS="FILENAME"
90 >//server/service</TT
91 > where <TT
92 CLASS="PARAMETER"
93 ><I
94 >server
95                 </I
96 ></TT
97 > is the NetBIOS name of the SMB/CIFS server 
98                 offering the desired service and <TT
99 CLASS="PARAMETER"
100 ><I
101 >service</I
102 ></TT
103
104                 is the name of the service offered.  Thus to connect to 
105                 the service "printer" on the SMB/CIFS server "smbserver",
106                 you would use the servicename <TT
107 CLASS="FILENAME"
108 >//smbserver/printer
109                 </TT
110 ></P
111 ><P
112 >Note that the server name required is NOT necessarily 
113                 the IP (DNS) host name of the server !  The name required is 
114                 a NetBIOS server name, which may or may not be the
115                 same as the IP hostname of the machine running the server.
116                 </P
117 ><P
118 >The server name is looked up according to either 
119                 the <TT
120 CLASS="PARAMETER"
121 ><I
122 >-R</I
123 ></TT
124 > parameter to smbclient or 
125                 using the name resolve order parameter in the smb.conf file, 
126                 allowing an administrator to change the order and methods 
127                 by which server names are looked up. </P
128 ></DD
129 ><DT
130 >password</DT
131 ><DD
132 ><P
133 >The password required to access the specified 
134                 service on the specified server. If this parameter is 
135                 supplied, the <TT
136 CLASS="PARAMETER"
137 ><I
138 >-N</I
139 ></TT
140 > option (suppress 
141                 password prompt) is assumed. </P
142 ><P
143 >There is no default password. If no password is supplied 
144                 on the command line (either by using this parameter or adding 
145                 a password to the <TT
146 CLASS="PARAMETER"
147 ><I
148 >-U</I
149 ></TT
150 > option (see 
151                 below)) and the <TT
152 CLASS="PARAMETER"
153 ><I
154 >-N</I
155 ></TT
156 > option is not 
157                 specified, the client will prompt for a password, even if 
158                 the desired service does not require one. (If no password is 
159                 required, simply press ENTER to provide a null password.)
160                 </P
161 ><P
162 >Note: Some servers (including OS/2 and Windows for 
163                 Workgroups) insist on an uppercase password. Lowercase 
164                 or mixed case passwords may be rejected by these servers.               
165                 </P
166 ><P
167 >Be cautious about including passwords in scripts.
168                 </P
169 ></DD
170 ><DT
171 >-s smb.conf</DT
172 ><DD
173 ><P
174 >Specifies the location of the all important 
175                 <TT
176 CLASS="FILENAME"
177 >smb.conf</TT
178 > file. </P
179 ></DD
180 ><DT
181 >-O socket options</DT
182 ><DD
183 ><P
184 >TCP socket options to set on the client 
185                 socket. See the socket options parameter in the <TT
186 CLASS="FILENAME"
187 >               smb.conf (5)</TT
188 > manpage for the list of valid 
189                 options. </P
190 ></DD
191 ><DT
192 >-R &#60;name resolve order&#62;</DT
193 ><DD
194 ><P
195 >This option is used by the programs in the Samba 
196                 suite to determine what naming services and in what order to resolve 
197                 host names to IP addresses. The option takes a space separated 
198                 string of different name resolution options.</P
199 ><P
200 >The options are :"lmhosts", "host", "wins" and "bcast". They 
201                 cause names to be resolved as follows :</P
202 ><P
203 ></P
204 ><UL
205 ><LI
206 ><P
207 ><TT
208 CLASS="CONSTANT"
209 >lmhosts</TT
210 > : Lookup an IP 
211                         address in the Samba lmhosts file. If the line in lmhosts has 
212                         no name type attached to the NetBIOS name (see the <A
213 HREF="lmhosts.5.html"
214 TARGET="_top"
215 >lmhosts(5)</A
216 > for details) then
217                         any name type matches for lookup.</P
218 ></LI
219 ><LI
220 ><P
221 ><TT
222 CLASS="CONSTANT"
223 >host</TT
224 > : Do a standard host 
225                         name to IP address resolution, using the system <TT
226 CLASS="FILENAME"
227 >/etc/hosts
228                         </TT
229 >, NIS, or DNS lookups. This method of name resolution 
230                         is operating system depended for instance on IRIX or Solaris this 
231                         may be controlled by the <TT
232 CLASS="FILENAME"
233 >/etc/nsswitch.conf</TT
234
235                         file).  Note that this method is only used if the NetBIOS name 
236                         type being queried is the 0x20 (server) name type, otherwise 
237                         it is ignored.</P
238 ></LI
239 ><LI
240 ><P
241 ><TT
242 CLASS="CONSTANT"
243 >wins</TT
244 > : Query a name with 
245                         the IP address listed in the <TT
246 CLASS="PARAMETER"
247 ><I
248 >wins server</I
249 ></TT
250 >
251                         parameter.  If no WINS server has
252                         been specified this method will be ignored.</P
253 ></LI
254 ><LI
255 ><P
256 ><TT
257 CLASS="CONSTANT"
258 >bcast</TT
259 > : Do a broadcast on 
260                         each of the known local interfaces listed in the 
261                         <TT
262 CLASS="PARAMETER"
263 ><I
264 >interfaces</I
265 ></TT
266 >
267                         parameter. This is the least reliable of the name resolution 
268                         methods as it depends on the target host being on a locally 
269                         connected subnet.</P
270 ></LI
271 ></UL
272 ><P
273 >If this parameter is not set then the name resolve order 
274                 defined in the <TT
275 CLASS="FILENAME"
276 >smb.conf</TT
277 > file parameter  
278                 (name resolve order) will be used. </P
279 ><P
280 >The default order is lmhosts, host, wins, bcast and without 
281                 this parameter or any entry in the <TT
282 CLASS="PARAMETER"
283 ><I
284 >name resolve order
285                 </I
286 ></TT
287 > parameter of the smb.conf file the name resolution
288                 methods will be attempted in this order. </P
289 ></DD
290 ><DT
291 >-M NetBIOS name</DT
292 ><DD
293 ><P
294 >This options allows you to send messages, using 
295                 the "WinPopup" protocol, to another computer. Once a connection is 
296                 established you then type your message, pressing ^D (control-D) to 
297                 end. </P
298 ><P
299 >If the receiving computer is running WinPopup the user will 
300                 receive the message and probably a beep. If they are not running 
301                 WinPopup the message will be lost, and no error message will 
302                 occur. </P
303 ><P
304 >The message is also automatically truncated if the message 
305                 is over 1600 bytes, as this is the limit of the protocol. 
306                 </P
307 ><P
308 >One useful trick is to cat the message through
309                 <B
310 CLASS="COMMAND"
311 >smbclient</B
312 >. For example: <B
313 CLASS="COMMAND"
314 >               cat mymessage.txt | smbclient -M FRED </B
315 > will 
316                 send the message in the file <TT
317 CLASS="FILENAME"
318 >mymessage.txt</TT
319
320                 to the machine FRED. </P
321 ><P
322 >You may also find the <TT
323 CLASS="PARAMETER"
324 ><I
325 >-U</I
326 ></TT
327 > and 
328                 <TT
329 CLASS="PARAMETER"
330 ><I
331 >-I</I
332 ></TT
333 > options useful, as they allow you to 
334                 control the FROM and TO parts of the message. </P
335 ><P
336 >See the message command parameter in the <TT
337 CLASS="FILENAME"
338 >               smb.conf(5)</TT
339 > for a description of how to handle incoming 
340                 WinPopup messages in Samba. </P
341 ><P
342 ><EM
343 >Note</EM
344 >: Copy WinPopup into the startup group 
345                 on your WfWg PCs if you want them to always be able to receive 
346                 messages. </P
347 ></DD
348 ><DT
349 >-i scope</DT
350 ><DD
351 ><P
352 >This specifies a NetBIOS scope that smbclient will 
353                 use to communicate with when generating NetBIOS names. For details 
354                 on the use of NetBIOS scopes, see rfc1001.txt and rfc1002.txt.
355                 NetBIOS scopes are <EM
356 >very</EM
357 > rarely used, only set 
358                 this parameter if you are the system administrator in charge of all 
359                 the NetBIOS systems you communicate with. </P
360 ></DD
361 ><DT
362 >-N</DT
363 ><DD
364 ><P
365 >If specified, this parameter suppresses the normal 
366                 password prompt from the client to the user. This is useful when 
367                 accessing a service that does not require a password. </P
368 ><P
369 >Unless a password is specified on the command line or 
370                 this parameter is specified, the client will request a 
371                 password.</P
372 ></DD
373 ><DT
374 >-n NetBIOS name</DT
375 ><DD
376 ><P
377 >By default, the client will use the local 
378                 machine's hostname (in uppercase) as its NetBIOS name. This parameter 
379                 allows you to override the host name and use whatever NetBIOS 
380                 name you wish. </P
381 ></DD
382 ><DT
383 >-d debuglevel</DT
384 ><DD
385 ><P
386 >debuglevel is an integer from 0 to 10, or 
387                 the letter 'A'. </P
388 ><P
389 >The default value if this parameter is not specified 
390                 is zero. </P
391 ><P
392 >The higher this value, the more detail will be logged to 
393                 the log files about the activities of the 
394                 client. At level 0, only critical errors and serious warnings will 
395                 be logged. Level 1 is a reasonable level for day to day running - 
396                 it generates a small amount of information about operations 
397                 carried out. </P
398 ><P
399 >Levels above 1 will generate considerable amounts of log 
400                 data, and should only be used when investigating a problem.
401                 Levels above 3 are designed for use only by developers and 
402                 generate HUGE amounts of log data, most of which is extremely 
403                 cryptic. If debuglevel is set to the letter 'A', then <EM
404 >all
405                 </EM
406 >  debug messages will be printed. This setting
407                 is for developers only (and people who <EM
408 >really</EM
409 > want 
410                 to know how the code works internally). </P
411 ><P
412 >Note that specifying this parameter here will override
413                 the log level parameter in the <B
414 CLASS="COMMAND"
415 >smb.conf (5)</B
416
417                 file. </P
418 ></DD
419 ><DT
420 >-p port</DT
421 ><DD
422 ><P
423 >This number is the TCP port number that will be used 
424                 when making connections to the server. The standard (well-known)
425                 TCP port number for an SMB/CIFS server is 139, which is the 
426                 default. </P
427 ></DD
428 ><DT
429 >-l logfilename</DT
430 ><DD
431 ><P
432 >If specified, logfilename specifies a base filename 
433                 into which operational data from the running client will be 
434                 logged. </P
435 ><P
436 >The default base name is specified at compile time.</P
437 ><P
438 >The base name is used to generate actual log file names.
439                 For example, if the name specified was "log", the debug file 
440                 would be <TT
441 CLASS="FILENAME"
442 >log.client</TT
443 >.</P
444 ><P
445 >The log file generated is never removed by the client.                 
446                 </P
447 ></DD
448 ><DT
449 >-h</DT
450 ><DD
451 ><P
452 >Print the usage message for the client. </P
453 ></DD
454 ><DT
455 >-I IP-address</DT
456 ><DD
457 ><P
458 >IP address is the address of the server to connect to. 
459                 It should be specified in standard "a.b.c.d" notation. </P
460 ><P
461 >Normally the client would attempt to locate a named 
462                 SMB/CIFS server by looking it up via the NetBIOS name resolution 
463                 mechanism described above in the <TT
464 CLASS="PARAMETER"
465 ><I
466 >name resolve order</I
467 ></TT
468
469                 parameter above. Using this parameter will force the client
470                 to assume that the server is on the machine with the specified IP 
471                 address and the NetBIOS name component of the resource being 
472                 connected to will be ignored. </P
473 ><P
474 >There is no default for this parameter. If not supplied, 
475                 it will be determined automatically by the client as described 
476                 above. </P
477 ></DD
478 ><DT
479 >-E</DT
480 ><DD
481 ><P
482 >This parameter causes the client to write messages 
483                 to the standard error stream (stderr) rather than to the standard 
484                 output stream. </P
485 ><P
486 >By default, the client writes messages to standard output 
487                 - typically the user's tty. </P
488 ></DD
489 ><DT
490 >-U username[%pass]</DT
491 ><DD
492 ><P
493 >Sets the SMB username or username and password. 
494                 If %pass is not specified, The user will be prompted. The client 
495                 will first check the USER environment variable, then the 
496                 <TT
497 CLASS="PARAMETER"
498 ><I
499 >$LOGNAME</I
500 ></TT
501 > variable and if either exist, the 
502                 string is uppercased. Anything in these variables following a '%' 
503                 sign will be treated as the password. If these environmental 
504                 variables are not found, the username <TT
505 CLASS="CONSTANT"
506 >GUEST</TT
507
508                 is used. </P
509 ><P
510 >If the password is not included in these environment 
511                 variables (using the %pass syntax), rpcclient will look for 
512                 a <TT
513 CLASS="PARAMETER"
514 ><I
515 >$PASSWD</I
516 ></TT
517 > environment variable from which 
518                 to read the password. </P
519 ><P
520 >A third option is to use a credentials file which 
521                 contains the plaintext of the username and password.  This 
522                 option is mainly provided for scripts where the admin doesn't 
523                 desire to pass the credentials on the command line or via environment 
524                 variables. If this method is used, make certain that the permissions 
525                 on the file restrict access from unwanted users.  See the 
526                 <TT
527 CLASS="PARAMETER"
528 ><I
529 >-A</I
530 ></TT
531 > for more details. </P
532 ><P
533 >Be cautious about including passwords in scripts or in 
534                 the <TT
535 CLASS="PARAMETER"
536 ><I
537 >$PASSWD</I
538 ></TT
539 > environment variable. Also, on 
540                 many systems the command line of a running process may be seen 
541                 via the <B
542 CLASS="COMMAND"
543 >ps</B
544 > command to be safe always allow 
545                 <B
546 CLASS="COMMAND"
547 >rpcclient</B
548 > to prompt for a password and type 
549                 it in directly. </P
550 ></DD
551 ><DT
552 >-A filename</DT
553 ><DD
554 ><P
555 >This option allows 
556                 you to specify a file from which to read the username and 
557                 password used in the connection.  The format of the file is 
558                 </P
559 ><P
560 ><TABLE
561 BORDER="0"
562 BGCOLOR="#E0E0E0"
563 WIDTH="90%"
564 ><TR
565 ><TD
566 ><PRE
567 CLASS="PROGRAMLISTING"
568 >username = &#60;value&#62; 
569 password = &#60;value&#62;
570                 </PRE
571 ></TD
572 ></TR
573 ></TABLE
574 ></P
575 ><P
576 >Make certain that the permissions on the file restrict 
577                 access from unwanted users. </P
578 ></DD
579 ><DT
580 >-L</DT
581 ><DD
582 ><P
583 >This option allows you to look at what services 
584                 are available on a server. You use it as <B
585 CLASS="COMMAND"
586 >smbclient -L 
587                 host</B
588 > and a list should appear.  The <TT
589 CLASS="PARAMETER"
590 ><I
591 >-I
592                 </I
593 ></TT
594 > option may be useful if your NetBIOS names don't 
595                 match your tcp/ip dns host names or if you are trying to reach a 
596                 host on another network. </P
597 ></DD
598 ><DT
599 >-t terminal code</DT
600 ><DD
601 ><P
602 >This option tells smbclient how to interpret 
603                 filenames coming from the remote server. Usually Asian language 
604                 multibyte UNIX implementations use different character sets than 
605                 SMB/CIFS servers (<EM
606 >EUC</EM
607 > instead of <EM
608 >               SJIS</EM
609 > for example). Setting this parameter will let 
610                 <B
611 CLASS="COMMAND"
612 >smbclient</B
613 > convert between the UNIX filenames and 
614                 the SMB filenames correctly. This option has not been seriously tested 
615                 and may have some problems. </P
616 ><P
617 >The terminal codes include CWsjis, CWeuc, CWjis7, CWjis8,
618                 CWjunet, CWhex, CWcap. This is not a complete list, check the Samba 
619                 source code for the complete list. </P
620 ></DD
621 ><DT
622 >-b buffersize</DT
623 ><DD
624 ><P
625 >This option changes the transmit/send buffer 
626                 size when getting or putting a file from/to the server. The default 
627                 is 65520 bytes. Setting this value smaller (to 1200 bytes) has been 
628                 observed to speed up file transfers to and from a Win9x server. 
629                 </P
630 ></DD
631 ><DT
632 >-W WORKGROUP</DT
633 ><DD
634 ><P
635 >Override the default workgroup specified in the 
636                 workgroup parameter of the <TT
637 CLASS="FILENAME"
638 >smb.conf</TT
639 > file 
640                 for this connection. This may be needed to connect to some 
641                 servers. </P
642 ></DD
643 ><DT
644 >-T tar options</DT
645 ><DD
646 ><P
647 >smbclient may be used to create <B
648 CLASS="COMMAND"
649 >tar(1)
650                 </B
651 > compatible backups of all the files on an SMB/CIFS
652                 share. The secondary tar flags that can be given to this option 
653                 are : </P
654 ><P
655 ></P
656 ><UL
657 ><LI
658 ><P
659 ><TT
660 CLASS="PARAMETER"
661 ><I
662 >c</I
663 ></TT
664 > - Create a tar file on UNIX. 
665                         Must be followed by the name of a tar file, tape device
666                         or "-" for standard output. If using standard output you must 
667                         turn the log level to its lowest value -d0 to avoid corrupting 
668                         your tar file. This flag is mutually exclusive with the 
669                         <TT
670 CLASS="PARAMETER"
671 ><I
672 >x</I
673 ></TT
674 > flag. </P
675 ></LI
676 ><LI
677 ><P
678 ><TT
679 CLASS="PARAMETER"
680 ><I
681 >x</I
682 ></TT
683 > - Extract (restore) a local 
684                         tar file back to a share. Unless the -D option is given, the tar 
685                         files will be restored from the top level of the share. Must be 
686                         followed by the name of the tar file, device or "-" for standard 
687                         input. Mutually exclusive with the <TT
688 CLASS="PARAMETER"
689 ><I
690 >c</I
691 ></TT
692 > flag. 
693                         Restored files have their creation times (mtime) set to the
694                         date saved in the tar file. Directories currently do not get 
695                         their creation dates restored properly. </P
696 ></LI
697 ><LI
698 ><P
699 ><TT
700 CLASS="PARAMETER"
701 ><I
702 >I</I
703 ></TT
704 > - Include files and directories. 
705                         Is the default behavior when filenames are specified above. Causes 
706                         tar files to be included in an extract or create (and therefore 
707                         everything else to be excluded). See example below.  Filename globbing 
708                         works  in one of two ways.  See r below. </P
709 ></LI
710 ><LI
711 ><P
712 ><TT
713 CLASS="PARAMETER"
714 ><I
715 >X</I
716 ></TT
717 > - Exclude files and directories. 
718                         Causes tar files to be excluded from an extract or create. See 
719                         example below.  Filename globbing works in one of two ways now. 
720                         See <TT
721 CLASS="PARAMETER"
722 ><I
723 >r</I
724 ></TT
725 > below. </P
726 ></LI
727 ><LI
728 ><P
729 ><TT
730 CLASS="PARAMETER"
731 ><I
732 >b</I
733 ></TT
734 > - Blocksize. Must be followed 
735                         by a valid (greater than zero) blocksize.  Causes tar file to be 
736                         written out in blocksize*TBLOCK (usually 512 byte) blocks. 
737                         </P
738 ></LI
739 ><LI
740 ><P
741 ><TT
742 CLASS="PARAMETER"
743 ><I
744 >g</I
745 ></TT
746 > - Incremental. Only back up 
747                         files that have the archive bit set. Useful only with the 
748                         <TT
749 CLASS="PARAMETER"
750 ><I
751 >c</I
752 ></TT
753 > flag. </P
754 ></LI
755 ><LI
756 ><P
757 ><TT
758 CLASS="PARAMETER"
759 ><I
760 >q</I
761 ></TT
762 > - Quiet. Keeps tar from printing 
763                         diagnostics as it works.  This is the same as tarmode quiet. 
764                         </P
765 ></LI
766 ><LI
767 ><P
768 ><TT
769 CLASS="PARAMETER"
770 ><I
771 >r</I
772 ></TT
773 > - Regular expression include
774                         or exclude.  Uses regular  regular expression matching for 
775                         excluding or excluding files if  compiled with HAVE_REGEX_H. 
776                         However this mode can be very slow. If  not compiled with 
777                         HAVE_REGEX_H, does a limited wildcard match on '*' and  '?'. 
778                         </P
779 ></LI
780 ><LI
781 ><P
782 ><TT
783 CLASS="PARAMETER"
784 ><I
785 >N</I
786 ></TT
787 > - Newer than. Must be followed 
788                         by the name of a file whose date is compared against files found 
789                         on the share during a create. Only files newer than the file 
790                         specified are backed up to the tar file. Useful only with the 
791                         <TT
792 CLASS="PARAMETER"
793 ><I
794 >c</I
795 ></TT
796 > flag. </P
797 ></LI
798 ><LI
799 ><P
800 ><TT
801 CLASS="PARAMETER"
802 ><I
803 >a</I
804 ></TT
805 > - Set archive bit. Causes the 
806                         archive bit to be reset when a file is backed up. Useful with the 
807                         <TT
808 CLASS="PARAMETER"
809 ><I
810 >g</I
811 ></TT
812 > and <TT
813 CLASS="PARAMETER"
814 ><I
815 >c</I
816 ></TT
817 > flags. 
818                         </P
819 ></LI
820 ></UL
821 ><P
822 ><EM
823 >Tar Long File Names</EM
824 ></P
825 ><P
826 ><B
827 CLASS="COMMAND"
828 >smbclient</B
829 >'s tar option now supports long 
830                 file names both on backup and restore. However, the full path 
831                 name of the file must be less than 1024 bytes.  Also, when
832                 a tar archive is created, smbclient's tar option places all 
833                 files in the archive with relative names, not absolute names. 
834                 </P
835 ><P
836 ><EM
837 >Tar Filenames</EM
838 ></P
839 ><P
840 >All file names can be given as DOS path names (with '\' 
841                 as the component separator) or as UNIX path names (with '/' as 
842                 the component separator). </P
843 ><P
844 ><EM
845 >Examples</EM
846 ></P
847 ><P
848 >Restore from tar file backup.tar into myshare on mypc 
849                 (no password on share). </P
850 ><P
851 ><B
852 CLASS="COMMAND"
853 >smbclient //mypc/myshare "" -N -Tx backup.tar
854                 </B
855 ></P
856 ><P
857 >Restore everything except <TT
858 CLASS="FILENAME"
859 >users/docs</TT
860 >
861                 </P
862 ><P
863 ><B
864 CLASS="COMMAND"
865 >smbclient //mypc/myshare "" -N -TXx backup.tar 
866                 users/docs</B
867 ></P
868 ><P
869 >Create a tar file of the files beneath <TT
870 CLASS="FILENAME"
871 >               users/docs</TT
872 >. </P
873 ><P
874 ><B
875 CLASS="COMMAND"
876 >smbclient //mypc/myshare "" -N -Tc
877                 backup.tar users/docs </B
878 ></P
879 ><P
880 >Create the same tar file as above, but now use 
881                 a DOS path name. </P
882 ><P
883 ><B
884 CLASS="COMMAND"
885 >smbclient //mypc/myshare "" -N -tc backup.tar 
886                 users\edocs </B
887 ></P
888 ><P
889 >Create a tar file of all the files and directories in 
890                 the share. </P
891 ><P
892 ><B
893 CLASS="COMMAND"
894 >smbclient //mypc/myshare "" -N -Tc backup.tar *
895                 </B
896 ></P
897 ></DD
898 ><DT
899 >-D initial directory</DT
900 ><DD
901 ><P
902 >Change to initial directory before starting. Probably 
903                 only of any use with the tar -T option. </P
904 ></DD
905 ><DT
906 >-c command string</DT
907 ><DD
908 ><P
909 >command string is a semicolon separated list of 
910                 commands to be executed instead of prompting from stdin. <TT
911 CLASS="PARAMETER"
912 ><I
913 >               -N</I
914 ></TT
915 > is implied by <TT
916 CLASS="PARAMETER"
917 ><I
918 >-c</I
919 ></TT
920 >.</P
921 ><P
922 >This is particularly useful in scripts and for printing stdin 
923                 to the server, e.g. <B
924 CLASS="COMMAND"
925 >-c 'print -'</B
926 >. </P
927 ></DD
928 ></DL
929 ></DIV
930 ></DIV
931 ><DIV
932 CLASS="REFSECT1"
933 ><A
934 NAME="AEN297"
935 ></A
936 ><H2
937 >OPERATIONS</H2
938 ><P
939 >Once the client is running, the user is presented with 
940         a prompt : </P
941 ><P
942 ><TT
943 CLASS="PROMPT"
944 >smb:\&#62; </TT
945 ></P
946 ><P
947 >The backslash ("\") indicates the current working directory 
948         on the server, and will change if the current working directory 
949         is changed. </P
950 ><P
951 >The prompt indicates that the client is ready and waiting to 
952         carry out a user command. Each command is a single word, optionally 
953         followed by parameters specific to that command. Command and parameters 
954         are space-delimited unless these notes specifically
955         state otherwise. All commands are case-insensitive.  Parameters to 
956         commands may or may not be case sensitive, depending on the command. 
957         </P
958 ><P
959 >You can specify file names which have spaces in them by quoting 
960         the name with double quotes, for example "a long file name". </P
961 ><P
962 >Parameters shown in square brackets (e.g., "[parameter]") are 
963         optional.  If not given, the command will use suitable defaults. Parameters 
964         shown in angle brackets (e.g., "&#60;parameter&#62;") are required.
965         </P
966 ><P
967 >Note that all commands operating on the server are actually 
968         performed by issuing a request to the server. Thus the behavior may 
969         vary from server to server, depending on how the server was implemented. 
970         </P
971 ><P
972 >The commands available are given here in alphabetical order. </P
973 ><P
974 ></P
975 ><DIV
976 CLASS="VARIABLELIST"
977 ><DL
978 ><DT
979 >? [command]</DT
980 ><DD
981 ><P
982 >If "command" is specified, the ? command will display 
983                 a brief informative message about the specified command.  If no 
984                 command is specified, a list of available commands will
985                 be displayed. </P
986 ></DD
987 ><DT
988 >! [shell command]</DT
989 ><DD
990 ><P
991 >If "shell command" is specified, the !  
992                 command will execute a shell locally and run the specified shell 
993                 command. If no command is specified, a local shell will be run. 
994                 </P
995 ></DD
996 ><DT
997 >cd [directory name]</DT
998 ><DD
999 ><P
1000 >If "directory name" is specified, the current 
1001                 working directory on the server will be changed to the directory 
1002                 specified. This operation will fail if for any reason the specified 
1003                 directory is inaccessible. </P
1004 ><P
1005 >If no directory name is specified, the current working 
1006                 directory on the server will be reported. </P
1007 ></DD
1008 ><DT
1009 >del &#60;mask&#62;</DT
1010 ><DD
1011 ><P
1012 >The client will request that the server attempt 
1013                 to delete all files matching "mask" from the current working 
1014                 directory on the server. </P
1015 ></DD
1016 ><DT
1017 >dir &#60;mask&#62;</DT
1018 ><DD
1019 ><P
1020 >A list of the files matching "mask" in the current 
1021                 working directory on the server will be retrieved from the server 
1022                 and displayed. </P
1023 ></DD
1024 ><DT
1025 >exit</DT
1026 ><DD
1027 ><P
1028 >Terminate the connection with the server and exit 
1029                 from the program. </P
1030 ></DD
1031 ><DT
1032 >get &#60;remote file name&#62; [local file name]</DT
1033 ><DD
1034 ><P
1035 >Copy the file called "remote file name" from 
1036                 the server to the machine running the client. If specified, name 
1037                 the local copy "local file name".  Note that all transfers in 
1038                 <B
1039 CLASS="COMMAND"
1040 >smbclient</B
1041 > are binary. See also the 
1042                 lowercase command. </P
1043 ></DD
1044 ><DT
1045 >help [command]</DT
1046 ><DD
1047 ><P
1048 >See the ? command above. </P
1049 ></DD
1050 ><DT
1051 >lcd [directory name]</DT
1052 ><DD
1053 ><P
1054 >If "directory name" is specified, the current 
1055                 working directory on the local machine will be changed to 
1056                 the directory specified. This operation will fail if for any 
1057                 reason the specified directory is inaccessible. </P
1058 ><P
1059 >If no directory name is specified, the name of the 
1060                 current working directory on the local machine will be reported. 
1061                 </P
1062 ></DD
1063 ><DT
1064 >lowercase</DT
1065 ><DD
1066 ><P
1067 >Toggle lowercasing of filenames for the get and 
1068                 mget commands. </P
1069 ><P
1070 >When lowercasing is toggled ON, local filenames are converted 
1071                 to lowercase when using the get and mget commands. This is
1072                 often useful when copying (say) MSDOS files from a server, because 
1073                 lowercase filenames are the norm on UNIX systems. </P
1074 ></DD
1075 ><DT
1076 >ls &#60;mask&#62;</DT
1077 ><DD
1078 ><P
1079 >See the dir command above. </P
1080 ></DD
1081 ><DT
1082 >mask &#60;mask&#62;</DT
1083 ><DD
1084 ><P
1085 >This command allows the user to set up a mask 
1086                 which will be used during recursive operation of the mget and 
1087                 mput commands. </P
1088 ><P
1089 >The masks specified to the mget and mput commands act as 
1090                 filters for directories rather than files when recursion is 
1091                 toggled ON. </P
1092 ><P
1093 >The mask specified with the mask command is necessary 
1094                 to filter files within those directories. For example, if the
1095                 mask specified in an mget command is "source*" and the mask 
1096                 specified with the mask command is "*.c" and recursion is 
1097                 toggled ON, the mget command will retrieve all files matching 
1098                 "*.c" in all directories below and including all directories 
1099                 matching "source*" in the current working directory. </P
1100 ><P
1101 >Note that the value for mask defaults to blank (equivalent 
1102                 to "*") and remains so until the mask command is used to change it. 
1103                 It retains the most recently specified value indefinitely. To 
1104                 avoid unexpected results it would be wise to change the value of 
1105                 mask back to "*" after using the mget or mput commands. </P
1106 ></DD
1107 ><DT
1108 >md &#60;directory name&#62;</DT
1109 ><DD
1110 ><P
1111 >See the mkdir command. </P
1112 ></DD
1113 ><DT
1114 >mget &#60;mask&#62;</DT
1115 ><DD
1116 ><P
1117 >Copy all files matching mask from the server to 
1118                 the machine running the client. </P
1119 ><P
1120 >Note that mask is interpreted differently during recursive 
1121                 operation and non-recursive operation - refer to the recurse and 
1122                 mask commands for more information. Note that all transfers in 
1123                 smbclient are binary. See also the lowercase command. </P
1124 ></DD
1125 ><DT
1126 >mkdir &#60;directory name&#62;</DT
1127 ><DD
1128 ><P
1129 >Create a new directory on the server (user access 
1130                 privileges permitting) with the specified name. </P
1131 ></DD
1132 ><DT
1133 >mput &#60;mask&#62;</DT
1134 ><DD
1135 ><P
1136 >Copy all files matching mask in the current working 
1137                 directory on the local machine to the current working directory on 
1138                 the server. </P
1139 ><P
1140 >Note that mask is interpreted differently during recursive 
1141                 operation and non-recursive operation - refer to the recurse and mask 
1142                 commands for more information. Note that all transfers in smbclient 
1143                 are binary. </P
1144 ></DD
1145 ><DT
1146 >print &#60;file name&#62;</DT
1147 ><DD
1148 ><P
1149 >Print the specified file from the local machine 
1150                 through a printable service on the server. </P
1151 ><P
1152 >See also the printmode command.</P
1153 ></DD
1154 ><DT
1155 >printmode &#60;graphics or text&#62;</DT
1156 ><DD
1157 ><P
1158 >Set the print mode to suit either binary data 
1159                 (such as graphical information) or text. Subsequent print
1160                 commands will use the currently set print mode. </P
1161 ></DD
1162 ><DT
1163 >prompt</DT
1164 ><DD
1165 ><P
1166 >Toggle prompting for filenames during operation 
1167                 of the mget and mput commands. </P
1168 ><P
1169 >When toggled ON, the user will be prompted to confirm 
1170                 the transfer of each file during these commands. When toggled 
1171                 OFF, all specified files will be transferred without prompting. 
1172                 </P
1173 ></DD
1174 ><DT
1175 >put &#60;local file name&#62; [remote file name]</DT
1176 ><DD
1177 ><P
1178 >Copy the file called "local file name" from the 
1179                 machine running the client to the server. If specified,
1180                 name the remote copy "remote file name". Note that all transfers 
1181                 in smbclient are binary. See also the lowercase command. 
1182                 </P
1183 ></DD
1184 ><DT
1185 >queue</DT
1186 ><DD
1187 ><P
1188 >Displays the print queue, showing the job id, 
1189                 name, size and current status. </P
1190 ></DD
1191 ><DT
1192 >quit</DT
1193 ><DD
1194 ><P
1195 >See the exit command. </P
1196 ></DD
1197 ><DT
1198 >rd &#60;directory name&#62;</DT
1199 ><DD
1200 ><P
1201 >See the rmdir command. </P
1202 ></DD
1203 ><DT
1204 >recurse</DT
1205 ><DD
1206 ><P
1207 >Toggle directory recursion for the commands mget 
1208                 and mput. </P
1209 ><P
1210 >When toggled ON, these commands will process all directories 
1211                 in the source directory (i.e., the directory they are copying
1212                 from ) and will recurse into any that match the mask specified 
1213                 to the command. Only files that match the mask specified using 
1214                 the mask command will be retrieved. See also the mask command. 
1215                 </P
1216 ><P
1217 >When recursion is toggled OFF, only files from the current 
1218                 working directory on the source machine that match the mask specified 
1219                 to the mget or mput commands will be copied, and any mask specified 
1220                 using the mask command will be ignored. </P
1221 ></DD
1222 ><DT
1223 >rm &#60;mask&#62;</DT
1224 ><DD
1225 ><P
1226 >Remove all files matching mask from the current 
1227                 working directory on the server. </P
1228 ></DD
1229 ><DT
1230 >rmdir &#60;directory name&#62;</DT
1231 ><DD
1232 ><P
1233 >Remove the specified directory (user access 
1234                 privileges permitting) from the server. </P
1235 ></DD
1236 ><DT
1237 >tar &#60;c|x&#62;[IXbgNa]</DT
1238 ><DD
1239 ><P
1240 >Performs a tar operation - see the <TT
1241 CLASS="PARAMETER"
1242 ><I
1243 >-T
1244                 </I
1245 ></TT
1246 > command line option above. Behavior may be affected 
1247                 by the tarmode command (see below). Using g (incremental) and N 
1248                 (newer) will affect tarmode settings. Note that using the "-" option 
1249                 with tar x may not work - use the command line option instead. 
1250                 </P
1251 ></DD
1252 ><DT
1253 >blocksize &#60;blocksize&#62;</DT
1254 ><DD
1255 ><P
1256 >Blocksize. Must be followed by a valid (greater 
1257                 than zero) blocksize. Causes tar file to be written out in 
1258                 blocksize*TBLOCK (usually 512 byte) blocks. </P
1259 ></DD
1260 ><DT
1261 >tarmode &#60;full|inc|reset|noreset&#62;</DT
1262 ><DD
1263 ><P
1264 >Changes tar's behavior with regard to archive 
1265                 bits. In full mode, tar will back up everything regardless of the 
1266                 archive bit setting (this is the default mode). In incremental mode, 
1267                 tar will only back up files with the archive bit set. In reset mode, 
1268                 tar will reset the archive bit on all files it backs up (implies 
1269                 read/write share). </P
1270 ></DD
1271 ><DT
1272 >setmode &#60;filename&#62; &#60;perm=[+|\-]rsha&#62;</DT
1273 ><DD
1274 ><P
1275 >A version of the DOS attrib command to set 
1276                 file permissions. For example: </P
1277 ><P
1278 ><B
1279 CLASS="COMMAND"
1280 >setmode myfile +r </B
1281 ></P
1282 ><P
1283 >would make myfile read only. </P
1284 ></DD
1285 ></DL
1286 ></DIV
1287 ></DIV
1288 ><DIV
1289 CLASS="REFSECT1"
1290 ><A
1291 NAME="AEN446"
1292 ></A
1293 ><H2
1294 >NOTES</H2
1295 ><P
1296 >Some servers are fussy about the case of supplied usernames, 
1297         passwords, share names (AKA service names) and machine names. 
1298         If you fail to connect try giving all parameters in uppercase. 
1299         </P
1300 ><P
1301 >It is often necessary to use the -n option when connecting 
1302         to some types of servers. For example OS/2 LanManager insists 
1303         on a valid NetBIOS name being used, so you need to supply a valid 
1304         name that would be known to the server.</P
1305 ><P
1306 >smbclient supports long file names where the server 
1307         supports the LANMAN2 protocol or above. </P
1308 ></DIV
1309 ><DIV
1310 CLASS="REFSECT1"
1311 ><A
1312 NAME="AEN451"
1313 ></A
1314 ><H2
1315 >ENVIRONMENT VARIABLES</H2
1316 ><P
1317 >The variable <TT
1318 CLASS="PARAMETER"
1319 ><I
1320 >$USER</I
1321 ></TT
1322 > may contain the 
1323         username of the person  using the client. This information is 
1324         used only if the protocol  level is high enough to support 
1325         session-level passwords.</P
1326 ><P
1327 >The variable <TT
1328 CLASS="PARAMETER"
1329 ><I
1330 >$PASSWD</I
1331 ></TT
1332 > may contain 
1333         the password of the person using the client.  This information is 
1334         used only if the protocol level is high enough to support 
1335         session-level passwords. </P
1336 ></DIV
1337 ><DIV
1338 CLASS="REFSECT1"
1339 ><A
1340 NAME="AEN457"
1341 ></A
1342 ><H2
1343 >INSTALLATION</H2
1344 ><P
1345 >The location of the client program is a matter for 
1346         individual system administrators. The following are thus
1347         suggestions only. </P
1348 ><P
1349 >It is recommended that the smbclient software be installed
1350         in the <TT
1351 CLASS="FILENAME"
1352 >/usr/local/samba/bin/</TT
1353 > or <TT
1354 CLASS="FILENAME"
1355 >       /usr/samba/bin/</TT
1356 > directory, this directory readable 
1357         by all, writeable only by root. The client program itself should 
1358         be executable by all. The client should <EM
1359 >NOT</EM
1360 > be 
1361         setuid or setgid! </P
1362 ><P
1363 >The client log files should be put in a directory readable 
1364         and writeable only by the user. </P
1365 ><P
1366 >To test the client, you will need to know the name of a 
1367         running SMB/CIFS server. It is possible to run <B
1368 CLASS="COMMAND"
1369 >smbd(8)
1370         </B
1371 > an ordinary user - running that server as a daemon 
1372         on a user-accessible port (typically any port number over 1024)
1373         would provide a suitable test server. </P
1374 ></DIV
1375 ><DIV
1376 CLASS="REFSECT1"
1377 ><A
1378 NAME="AEN467"
1379 ></A
1380 ><H2
1381 >DIAGNOSTICS</H2
1382 ><P
1383 >Most diagnostics issued by the client are logged in a 
1384         specified log file. The log file name is specified at compile time, 
1385         but may be overridden on the command line. </P
1386 ><P
1387 >The number and nature of diagnostics available depends 
1388         on the debug level used by the client. If you have problems, 
1389         set the debug level to 3 and peruse the log files. </P
1390 ></DIV
1391 ><DIV
1392 CLASS="REFSECT1"
1393 ><A
1394 NAME="AEN471"
1395 ></A
1396 ><H2
1397 >VERSION</H2
1398 ><P
1399 >This man page is correct for version 2.2 of 
1400         the Samba suite.</P
1401 ></DIV
1402 ><DIV
1403 CLASS="REFSECT1"
1404 ><A
1405 NAME="AEN474"
1406 ></A
1407 ><H2
1408 >AUTHOR</H2
1409 ><P
1410 >The original Samba software and related utilities 
1411         were created by Andrew Tridgell. Samba is now developed
1412         by the Samba Team as an Open Source project similar 
1413         to the way the Linux kernel is developed.</P
1414 ><P
1415 >The original Samba man pages were written by Karl Auer. 
1416         The man page sources were converted to YODL format (another 
1417         excellent piece of Open Source software, available at
1418         <A
1419 HREF="ftp://ftp.icce.rug.nl/pub/unix/"
1420 TARGET="_top"
1421 >       ftp://ftp.icce.rug.nl/pub/unix/</A
1422 >) and updated for the Samba 2.0 
1423         release by Jeremy Allison.  The conversion to DocBook for 
1424         Samba 2.2 was done by Gerald Carter</P
1425 ></DIV
1426 ></BODY
1427 ></HTML
1428 >