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