merging some changes from SAMBA_2_2
[bbaumbach/samba-autobuild/.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 (domain) specified
677                 in the workgroup parameter of the <TT
678 CLASS="FILENAME"
679 >smb.conf</TT
680 >
681                 file 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 >altname file</DT
1055 ><DD
1056 ><P
1057 >The client will request that the server return
1058                 the "alternate" name (the 8.3 name) for a file or directory.
1059                 </P
1060 ></DD
1061 ><DT
1062 >cancel jobid0 [jobid1] ... [jobidN]</DT
1063 ><DD
1064 ><P
1065 >The client will request that the server cancel
1066                 the printjobs identified by the given numeric print job ids.
1067                 </P
1068 ></DD
1069 ><DT
1070 >chmod file mode in octal</DT
1071 ><DD
1072 ><P
1073 >This command depends on the server supporting the CIFS
1074                 UNIX extensions and will fail if the server does not. The client requests that the server
1075                 change the UNIX permissions to the given octal mode, in standard UNIX format.
1076                 </P
1077 ></DD
1078 ><DT
1079 >chown file uid gid</DT
1080 ><DD
1081 ><P
1082 >This command depends on the server supporting the CIFS
1083                 UNIX extensions and will fail if the server does not. The client requests that the server
1084                 change the UNIX user and group ownership to the given decimal values. Note there is
1085                 currently no way to remotely look up the UNIX uid and gid values for a given name.
1086                 This may be addressed in future versions of the CIFS UNIX extensions.
1087                 </P
1088 ></DD
1089 ><DT
1090 >cd [directory name]</DT
1091 ><DD
1092 ><P
1093 >If "directory name" is specified, the current 
1094                 working directory on the server will be changed to the directory 
1095                 specified. This operation will fail if for any reason the specified 
1096                 directory is inaccessible. </P
1097 ><P
1098 >If no directory name is specified, the current working 
1099                 directory on the server will be reported. </P
1100 ></DD
1101 ><DT
1102 >del &#60;mask&#62;</DT
1103 ><DD
1104 ><P
1105 >The client will request that the server attempt 
1106                 to delete all files matching <TT
1107 CLASS="REPLACEABLE"
1108 ><I
1109 >mask</I
1110 ></TT
1111 > from the current working 
1112                 directory on the server. </P
1113 ></DD
1114 ><DT
1115 >dir &#60;mask&#62;</DT
1116 ><DD
1117 ><P
1118 >A list of the files matching <TT
1119 CLASS="REPLACEABLE"
1120 ><I
1121 >mask</I
1122 ></TT
1123 > in the current 
1124                 working directory on the server will be retrieved from the server 
1125                 and displayed. </P
1126 ></DD
1127 ><DT
1128 >exit</DT
1129 ><DD
1130 ><P
1131 >Terminate the connection with the server and exit 
1132                 from the program. </P
1133 ></DD
1134 ><DT
1135 >get &#60;remote file name&#62; [local file name]</DT
1136 ><DD
1137 ><P
1138 >Copy the file called <TT
1139 CLASS="FILENAME"
1140 >remote file name</TT
1141 > from 
1142                 the server to the machine running the client. If specified, name 
1143                 the local copy <TT
1144 CLASS="FILENAME"
1145 >local file name</TT
1146 >.  Note that all transfers in 
1147                 <B
1148 CLASS="COMMAND"
1149 >smbclient</B
1150 > are binary. See also the 
1151                 lowercase command. </P
1152 ></DD
1153 ><DT
1154 >help [command]</DT
1155 ><DD
1156 ><P
1157 >See the ? command above. </P
1158 ></DD
1159 ><DT
1160 >lcd [directory name]</DT
1161 ><DD
1162 ><P
1163 >If <TT
1164 CLASS="REPLACEABLE"
1165 ><I
1166 >directory name</I
1167 ></TT
1168 > is specified, the current 
1169                 working directory on the local machine will be changed to 
1170                 the directory specified. This operation will fail if for any 
1171                 reason the specified directory is inaccessible. </P
1172 ><P
1173 >If no directory name is specified, the name of the 
1174                 current working directory on the local machine will be reported. 
1175                 </P
1176 ></DD
1177 ><DT
1178 >link source destination</DT
1179 ><DD
1180 ><P
1181 >This command depends on the server supporting the CIFS
1182                 UNIX extensions and will fail if the server does not. The client requests that the server
1183                 create a hard link between the source and destination files. The source file
1184                 must not exist.
1185                 </P
1186 ></DD
1187 ><DT
1188 >lowercase</DT
1189 ><DD
1190 ><P
1191 >Toggle lowercasing of filenames for the get and 
1192                 mget commands. </P
1193 ><P
1194 >When lowercasing is toggled ON, local filenames are converted 
1195                 to lowercase when using the get and mget commands. This is
1196                 often useful when copying (say) MSDOS files from a server, because 
1197                 lowercase filenames are the norm on UNIX systems. </P
1198 ></DD
1199 ><DT
1200 >ls &#60;mask&#62;</DT
1201 ><DD
1202 ><P
1203 >See the dir command above. </P
1204 ></DD
1205 ><DT
1206 >mask &#60;mask&#62;</DT
1207 ><DD
1208 ><P
1209 >This command allows the user to set up a mask 
1210                 which will be used during recursive operation of the mget and 
1211                 mput commands. </P
1212 ><P
1213 >The masks specified to the mget and mput commands act as 
1214                 filters for directories rather than files when recursion is 
1215                 toggled ON. </P
1216 ><P
1217 >The mask specified with the mask command is necessary 
1218                 to filter files within those directories. For example, if the
1219                 mask specified in an mget command is "source*" and the mask 
1220                 specified with the mask command is "*.c" and recursion is 
1221                 toggled ON, the mget command will retrieve all files matching 
1222                 "*.c" in all directories below and including all directories 
1223                 matching "source*" in the current working directory. </P
1224 ><P
1225 >Note that the value for mask defaults to blank (equivalent 
1226                 to "*") and remains so until the mask command is used to change it. 
1227                 It retains the most recently specified value indefinitely. To 
1228                 avoid unexpected results it would be wise to change the value of 
1229                 mask back to "*" after using the mget or mput commands. </P
1230 ></DD
1231 ><DT
1232 >md &#60;directory name&#62;</DT
1233 ><DD
1234 ><P
1235 >See the mkdir command. </P
1236 ></DD
1237 ><DT
1238 >mget &#60;mask&#62;</DT
1239 ><DD
1240 ><P
1241 >Copy all files matching <TT
1242 CLASS="REPLACEABLE"
1243 ><I
1244 >mask</I
1245 ></TT
1246 > from the server to 
1247                 the machine running the client. </P
1248 ><P
1249 >Note that <TT
1250 CLASS="REPLACEABLE"
1251 ><I
1252 >mask</I
1253 ></TT
1254 > is interpreted differently during recursive 
1255                 operation and non-recursive operation - refer to the recurse and 
1256                 mask commands for more information. Note that all transfers in 
1257                 <B
1258 CLASS="COMMAND"
1259 >smbclient</B
1260 > are binary. See also the lowercase command. </P
1261 ></DD
1262 ><DT
1263 >mkdir &#60;directory name&#62;</DT
1264 ><DD
1265 ><P
1266 >Create a new directory on the server (user access 
1267                 privileges permitting) with the specified name. </P
1268 ></DD
1269 ><DT
1270 >mput &#60;mask&#62;</DT
1271 ><DD
1272 ><P
1273 >Copy all files matching <TT
1274 CLASS="REPLACEABLE"
1275 ><I
1276 >mask</I
1277 ></TT
1278 > in the current working 
1279                 directory on the local machine to the current working directory on 
1280                 the server. </P
1281 ><P
1282 >Note that <TT
1283 CLASS="REPLACEABLE"
1284 ><I
1285 >mask</I
1286 ></TT
1287 > is interpreted differently during recursive 
1288                 operation and non-recursive operation - refer to the recurse and mask 
1289                 commands for more information. Note that all transfers in <B
1290 CLASS="COMMAND"
1291 >smbclient</B
1292
1293                 are binary. </P
1294 ></DD
1295 ><DT
1296 >print &#60;file name&#62;</DT
1297 ><DD
1298 ><P
1299 >Print the specified file from the local machine 
1300                 through a printable service on the server. </P
1301 ><P
1302 >See also the printmode command.</P
1303 ></DD
1304 ><DT
1305 >printmode &#60;graphics or text&#62;</DT
1306 ><DD
1307 ><P
1308 >Set the print mode to suit either binary data 
1309                 (such as graphical information) or text. Subsequent print
1310                 commands will use the currently set print mode. </P
1311 ></DD
1312 ><DT
1313 >prompt</DT
1314 ><DD
1315 ><P
1316 >Toggle prompting for filenames during operation 
1317                 of the mget and mput commands. </P
1318 ><P
1319 >When toggled ON, the user will be prompted to confirm 
1320                 the transfer of each file during these commands. When toggled 
1321                 OFF, all specified files will be transferred without prompting. 
1322                 </P
1323 ></DD
1324 ><DT
1325 >put &#60;local file name&#62; [remote file name]</DT
1326 ><DD
1327 ><P
1328 >Copy the file called <TT
1329 CLASS="FILENAME"
1330 >local file name</TT
1331 > from the 
1332                 machine running the client to the server. If specified,
1333                 name the remote copy <TT
1334 CLASS="FILENAME"
1335 >remote file name</TT
1336 >. Note that all transfers 
1337                 in <B
1338 CLASS="COMMAND"
1339 >smbclient</B
1340 > are binary. See also the lowercase command. 
1341                 </P
1342 ></DD
1343 ><DT
1344 >queue</DT
1345 ><DD
1346 ><P
1347 >Displays the print queue, showing the job id, 
1348                 name, size and current status. </P
1349 ></DD
1350 ><DT
1351 >quit</DT
1352 ><DD
1353 ><P
1354 >See the exit command. </P
1355 ></DD
1356 ><DT
1357 >rd &#60;directory name&#62;</DT
1358 ><DD
1359 ><P
1360 >See the rmdir command. </P
1361 ></DD
1362 ><DT
1363 >recurse</DT
1364 ><DD
1365 ><P
1366 >Toggle directory recursion for the commands mget 
1367                 and mput. </P
1368 ><P
1369 >When toggled ON, these commands will process all directories 
1370                 in the source directory (i.e., the directory they are copying
1371                 from ) and will recurse into any that match the mask specified 
1372                 to the command. Only files that match the mask specified using 
1373                 the mask command will be retrieved. See also the mask command. 
1374                 </P
1375 ><P
1376 >When recursion is toggled OFF, only files from the current 
1377                 working directory on the source machine that match the mask specified 
1378                 to the mget or mput commands will be copied, and any mask specified 
1379                 using the mask command will be ignored. </P
1380 ></DD
1381 ><DT
1382 >rm &#60;mask&#62;</DT
1383 ><DD
1384 ><P
1385 >Remove all files matching <TT
1386 CLASS="REPLACEABLE"
1387 ><I
1388 >mask</I
1389 ></TT
1390 > from the current 
1391                 working directory on the server. </P
1392 ></DD
1393 ><DT
1394 >rmdir &#60;directory name&#62;</DT
1395 ><DD
1396 ><P
1397 >Remove the specified directory (user access 
1398                 privileges permitting) from the server. </P
1399 ></DD
1400 ><DT
1401 >setmode &#60;filename&#62; &#60;perm=[+|\-]rsha&#62;</DT
1402 ><DD
1403 ><P
1404 >A version of the DOS attrib command to set 
1405                 file permissions. For example: </P
1406 ><P
1407 ><B
1408 CLASS="COMMAND"
1409 >setmode myfile +r </B
1410 ></P
1411 ><P
1412 >would make myfile read only. </P
1413 ></DD
1414 ><DT
1415 >symlink source destination</DT
1416 ><DD
1417 ><P
1418 >This command depends on the server supporting the CIFS
1419                 UNIX extensions and will fail if the server does not. The client requests that the server
1420                 create a symbolic hard link between the source and destination files. The source file
1421                 must not exist. Note that the server will not create a link to any path that lies 
1422                 outside the currently connected share. This is enforced by the Samba server.
1423                 </P
1424 ></DD
1425 ><DT
1426 >tar &#60;c|x&#62;[IXbgNa]</DT
1427 ><DD
1428 ><P
1429 >Performs a tar operation - see the <TT
1430 CLASS="PARAMETER"
1431 ><I
1432 >-T
1433                 </I
1434 ></TT
1435 > command line option above. Behavior may be affected 
1436                 by the tarmode command (see below). Using g (incremental) and N 
1437                 (newer) will affect tarmode settings. Note that using the "-" option 
1438                 with tar x may not work - use the command line option instead. 
1439                 </P
1440 ></DD
1441 ><DT
1442 >blocksize &#60;blocksize&#62;</DT
1443 ><DD
1444 ><P
1445 >Blocksize. Must be followed by a valid (greater 
1446                 than zero) blocksize. Causes tar file to be written out in 
1447                 <TT
1448 CLASS="REPLACEABLE"
1449 ><I
1450 >blocksize</I
1451 ></TT
1452 >*TBLOCK (usually 512 byte) blocks. </P
1453 ></DD
1454 ><DT
1455 >tarmode &#60;full|inc|reset|noreset&#62;</DT
1456 ><DD
1457 ><P
1458 >Changes tar's behavior with regard to archive 
1459                 bits. In full mode, tar will back up everything regardless of the 
1460                 archive bit setting (this is the default mode). In incremental mode, 
1461                 tar will only back up files with the archive bit set. In reset mode, 
1462                 tar will reset the archive bit on all files it backs up (implies 
1463                 read/write share). </P
1464 ></DD
1465 ></DL
1466 ></DIV
1467 ></DIV
1468 ><DIV
1469 CLASS="REFSECT1"
1470 ><A
1471 NAME="AEN501"
1472 ></A
1473 ><H2
1474 >NOTES</H2
1475 ><P
1476 >Some servers are fussy about the case of supplied usernames, 
1477         passwords, share names (AKA service names) and machine names. 
1478         If you fail to connect try giving all parameters in uppercase. 
1479         </P
1480 ><P
1481 >It is often necessary to use the -n option when connecting 
1482         to some types of servers. For example OS/2 LanManager insists 
1483         on a valid NetBIOS name being used, so you need to supply a valid 
1484         name that would be known to the server.</P
1485 ><P
1486 >smbclient supports long file names where the server 
1487         supports the LANMAN2 protocol or above. </P
1488 ></DIV
1489 ><DIV
1490 CLASS="REFSECT1"
1491 ><A
1492 NAME="AEN506"
1493 ></A
1494 ><H2
1495 >ENVIRONMENT VARIABLES</H2
1496 ><P
1497 >The variable <TT
1498 CLASS="ENVAR"
1499 >USER</TT
1500 > may contain the 
1501         username of the person  using the client. This information is 
1502         used only if the protocol  level is high enough to support 
1503         session-level passwords.</P
1504 ><P
1505 >The variable <TT
1506 CLASS="ENVAR"
1507 >PASSWD</TT
1508 > may contain 
1509         the password of the person using the client.  This information is 
1510         used only if the protocol level is high enough to support 
1511         session-level passwords. </P
1512 ><P
1513 >The variable <TT
1514 CLASS="ENVAR"
1515 >LIBSMB_PROG</TT
1516 > may contain 
1517         the path, executed with system(), which the client should connect 
1518         to instead of connecting to a server.  This functionality is primarily
1519         intended as a development aid, and works best when using a LMHOSTS 
1520         file</P
1521 ></DIV
1522 ><DIV
1523 CLASS="REFSECT1"
1524 ><A
1525 NAME="AEN514"
1526 ></A
1527 ><H2
1528 >INSTALLATION</H2
1529 ><P
1530 >The location of the client program is a matter for 
1531         individual system administrators. The following are thus
1532         suggestions only. </P
1533 ><P
1534 >It is recommended that the smbclient software be installed
1535         in the <TT
1536 CLASS="FILENAME"
1537 >/usr/local/samba/bin/</TT
1538 > or <TT
1539 CLASS="FILENAME"
1540 >       /usr/samba/bin/</TT
1541 > directory, this directory readable 
1542         by all, writeable only by root. The client program itself should 
1543         be executable by all. The client should <EM
1544 >NOT</EM
1545 > be 
1546         setuid or setgid! </P
1547 ><P
1548 >The client log files should be put in a directory readable 
1549         and writeable only by the user. </P
1550 ><P
1551 >To test the client, you will need to know the name of a 
1552         running SMB/CIFS server. It is possible to run <B
1553 CLASS="COMMAND"
1554 >smbd(8)
1555         </B
1556 > as an ordinary user - running that server as a daemon 
1557         on a user-accessible port (typically any port number over 1024)
1558         would provide a suitable test server. </P
1559 ></DIV
1560 ><DIV
1561 CLASS="REFSECT1"
1562 ><A
1563 NAME="AEN524"
1564 ></A
1565 ><H2
1566 >DIAGNOSTICS</H2
1567 ><P
1568 >Most diagnostics issued by the client are logged in a 
1569         specified log file. The log file name is specified at compile time, 
1570         but may be overridden on the command line. </P
1571 ><P
1572 >The number and nature of diagnostics available depends 
1573         on the debug level used by the client. If you have problems, 
1574         set the debug level to 3 and peruse the log files. </P
1575 ></DIV
1576 ><DIV
1577 CLASS="REFSECT1"
1578 ><A
1579 NAME="AEN528"
1580 ></A
1581 ><H2
1582 >VERSION</H2
1583 ><P
1584 >This man page is correct for version 2.2 of 
1585         the Samba suite.</P
1586 ></DIV
1587 ><DIV
1588 CLASS="REFSECT1"
1589 ><A
1590 NAME="AEN531"
1591 ></A
1592 ><H2
1593 >AUTHOR</H2
1594 ><P
1595 >The original Samba software and related utilities 
1596         were created by Andrew Tridgell. Samba is now developed
1597         by the Samba Team as an Open Source project similar 
1598         to the way the Linux kernel is developed.</P
1599 ><P
1600 >The original Samba man pages were written by Karl Auer. 
1601         The man page sources were converted to YODL format (another 
1602         excellent piece of Open Source software, available at
1603         <A
1604 HREF="ftp://ftp.icce.rug.nl/pub/unix/"
1605 TARGET="_top"
1606 >       ftp://ftp.icce.rug.nl/pub/unix/</A
1607 >) and updated for the Samba 2.0 
1608         release by Jeremy Allison.  The conversion to DocBook for 
1609         Samba 2.2 was done by Gerald Carter</P
1610 ></DIV
1611 ></BODY
1612 ></HTML
1613 >