source: branches/samba-3.3.x/docs/manpages/smbclient.1@ 216

Last change on this file since 216 was 216, checked in by Herwig Bauernfeind, 16 years ago

Import Samba 3.3 branch at 3.3.0 level docs (psmedley's port)

File size: 42.1 KB
Line 
1.\" Title: smbclient
2.\" Author: [see the "AUTHOR" section]
3.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
4.\" Date: 01/27/2009
5.\" Manual: User Commands
6.\" Source: Samba 3.3
7.\" Language: English
8.\"
9.TH "SMBCLIENT" "1" "01/27/2009" "Samba 3\&.3" "User Commands"
10.\" -----------------------------------------------------------------
11.\" * (re)Define some macros
12.\" -----------------------------------------------------------------
13.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14.\" toupper - uppercase a string (locale-aware)
15.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16.de toupper
17.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
18\\$*
19.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
20..
21.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22.\" SH-xref - format a cross-reference to an SH section
23.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24.de SH-xref
25.ie n \{\
26.\}
27.toupper \\$*
28.el \{\
29\\$*
30.\}
31..
32.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33.\" SH - level-one heading that works better for non-TTY output
34.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35.de1 SH
36.\" put an extra blank line of space above the head in non-TTY output
37.if t \{\
38.sp 1
39.\}
40.sp \\n[PD]u
41.nr an-level 1
42.set-an-margin
43.nr an-prevailing-indent \\n[IN]
44.fi
45.in \\n[an-margin]u
46.ti 0
47.HTML-TAG ".NH \\n[an-level]"
48.it 1 an-trap
49.nr an-no-space-flag 1
50.nr an-break-flag 1
51\." make the size of the head bigger
52.ps +3
53.ft B
54.ne (2v + 1u)
55.ie n \{\
56.\" if n (TTY output), use uppercase
57.toupper \\$*
58.\}
59.el \{\
60.nr an-break-flag 0
61.\" if not n (not TTY), use normal case (not uppercase)
62\\$1
63.in \\n[an-margin]u
64.ti 0
65.\" if not n (not TTY), put a border/line under subheading
66.sp -.6
67\l'\n(.lu'
68.\}
69..
70.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
71.\" SS - level-two heading that works better for non-TTY output
72.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73.de1 SS
74.sp \\n[PD]u
75.nr an-level 1
76.set-an-margin
77.nr an-prevailing-indent \\n[IN]
78.fi
79.in \\n[IN]u
80.ti \\n[SN]u
81.it 1 an-trap
82.nr an-no-space-flag 1
83.nr an-break-flag 1
84.ps \\n[PS-SS]u
85\." make the size of the head bigger
86.ps +2
87.ft B
88.ne (2v + 1u)
89.if \\n[.$] \&\\$*
90..
91.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
92.\" BB/BE - put background/screen (filled box) around block of text
93.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
94.de BB
95.if t \{\
96.sp -.5
97.br
98.in +2n
99.ll -2n
100.gcolor red
101.di BX
102.\}
103..
104.de EB
105.if t \{\
106.if "\\$2"adjust-for-leading-newline" \{\
107.sp -1
108.\}
109.br
110.di
111.in
112.ll
113.gcolor
114.nr BW \\n(.lu-\\n(.i
115.nr BH \\n(dn+.5v
116.ne \\n(BHu+.5v
117.ie "\\$2"adjust-for-leading-newline" \{\
118\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
119.\}
120.el \{\
121\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
122.\}
123.in 0
124.sp -.5v
125.nf
126.BX
127.in
128.sp .5v
129.fi
130.\}
131..
132.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
133.\" BM/EM - put colored marker in margin next to block of text
134.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
135.de BM
136.if t \{\
137.br
138.ll -2n
139.gcolor red
140.di BX
141.\}
142..
143.de EM
144.if t \{\
145.br
146.di
147.ll
148.gcolor
149.nr BH \\n(dn
150.ne \\n(BHu
151\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
152.in 0
153.nf
154.BX
155.in
156.fi
157.\}
158..
159.\" -----------------------------------------------------------------
160.\" * set default formatting
161.\" -----------------------------------------------------------------
162.\" disable hyphenation
163.nh
164.\" disable justification (adjust text to left margin only)
165.ad l
166.\" -----------------------------------------------------------------
167.\" * MAIN CONTENT STARTS HERE *
168.\" -----------------------------------------------------------------
169.SH "Name"
170smbclient \- ftp\-like client to access SMB/CIFS resources on servers
171.SH "Synopsis"
172.fam C
173.HP \w'\ 'u
174\FCsmbclient\F[] [\-b\ <buffer\ size>] [\-d\ debuglevel] [\-e] [\-L\ <netbios\ name>] [\-U\ username] [\-I\ destinationIP] [\-M\ <netbios\ name>] [\-m\ maxprotocol] [\-A\ authfile] [\-N] [\-g] [\-i\ scope] [\-O\ <socket\ options>] [\-p\ port] [\-R\ <name\ resolve\ order>] [\-s\ <smb\ config\ file>] [\-k] [\-P] [\-c\ <command>]
175.fam
176.fam C
177.HP \w'\ 'u
178\FCsmbclient\F[] {servicename} [password] [\-b\ <buffer\ size>] [\-d\ debuglevel] [\-e] [\-D\ Directory] [\-U\ username] [\-W\ workgroup] [\-M\ <netbios\ name>] [\-m\ maxprotocol] [\-A\ authfile] [\-N] [\-g] [\-l\ log\-basename] [\-I\ destinationIP] [\-E] [\-c\ <command\ string>] [\-i\ scope] [\-O\ <socket\ options>] [\-p\ port] [\-R\ <name\ resolve\ order>] [\-s\ <smb\ config\ file>] [\-T<c|x>IXFqgbNan] [\-k]
179.fam
180.SH "DESCRIPTION"
181.PP
182This tool is part of the
183\fBsamba\fR(7)
184suite\&.
185.PP
186\FCsmbclient\F[]
187is a client that can \'talk\' to an SMB/CIFS server\&. It offers an interface similar to that of the ftp program (see
188\fBftp\fR(1))\&. Operations include things like getting files from the server to the local machine, putting files from the local machine to the server, retrieving directory information from the server and so on\&.
189.SH "OPTIONS"
190.PP
191servicename
192.RS 4
193servicename is the name of the service you want to use on the server\&. A service name takes the form
194\FC//server/service\F[]
195where
196\fIserver \fR
197is the NetBIOS name of the SMB/CIFS server offering the desired service and
198\fIservice\fR
199is the name of the service offered\&. Thus to connect to the service "printer" on the SMB/CIFS server "smbserver", you would use the servicename
200\FC//smbserver/printer \F[]
201.sp
202Note that the server name required is NOT necessarily the IP (DNS) host name of the server ! The name required is a NetBIOS server name, which may or may not be the same as the IP hostname of the machine running the server\&.
203.sp
204The server name is looked up according to either the
205\fI\-R\fR
206parameter to
207\FCsmbclient\F[]
208or using the name resolve order parameter in the
209\fBsmb.conf\fR(5)
210file, allowing an administrator to change the order and methods by which server names are looked up\&.
211.RE
212.PP
213password
214.RS 4
215The password required to access the specified service on the specified server\&. If this parameter is supplied, the
216\fI\-N\fR
217option (suppress password prompt) is assumed\&.
218.sp
219There is no default password\&. If no password is supplied on the command line (either by using this parameter or adding a password to the
220\fI\-U\fR
221option (see below)) and the
222\fI\-N\fR
223option is not specified, the client will prompt for a password, even if the desired service does not require one\&. (If no password is required, simply press ENTER to provide a null password\&.)
224.sp
225Note: Some servers (including OS/2 and Windows for Workgroups) insist on an uppercase password\&. Lowercase or mixed case passwords may be rejected by these servers\&.
226.sp
227Be cautious about including passwords in scripts\&.
228.RE
229.PP
230\-R <name resolve order>
231.RS 4
232This option is used by the programs in the Samba suite to determine what naming services and in what order to resolve host names to IP addresses\&. The option takes a space\-separated string of different name resolution options\&.
233.sp
234The options are :"lmhosts", "host", "wins" and "bcast"\&. They cause names to be resolved as follows:
235.sp
236.RS 4
237.ie n \{\
238\h'-04'\(bu\h'+03'\c
239.\}
240.el \{\
241.sp -1
242.IP \(bu 2.3
243.\}
244\fBlmhosts\fR: Lookup an IP address in the Samba lmhosts file\&. If the line in lmhosts has no name type attached to the NetBIOS name (see the
245\fBlmhosts\fR(5)
246for details) then any name type matches for lookup\&.
247.RE
248.sp
249.RS 4
250.ie n \{\
251\h'-04'\(bu\h'+03'\c
252.\}
253.el \{\
254.sp -1
255.IP \(bu 2.3
256.\}
257\fBhost\fR: Do a standard host name to IP address resolution, using the system
258\FC/etc/hosts \F[], NIS, or DNS lookups\&. This method of name resolution is operating system dependent, for instance on IRIX or Solaris this may be controlled by the
259\FC/etc/nsswitch\&.conf\F[]
260file)\&. Note that this method is only used if the NetBIOS name type being queried is the 0x20 (server) name type, otherwise it is ignored\&.
261.RE
262.sp
263.RS 4
264.ie n \{\
265\h'-04'\(bu\h'+03'\c
266.\}
267.el \{\
268.sp -1
269.IP \(bu 2.3
270.\}
271\fBwins\fR: Query a name with the IP address listed in the
272\fIwins server\fR
273parameter\&. If no WINS server has been specified this method will be ignored\&.
274.RE
275.sp
276.RS 4
277.ie n \{\
278\h'-04'\(bu\h'+03'\c
279.\}
280.el \{\
281.sp -1
282.IP \(bu 2.3
283.\}
284\fBbcast\fR: Do a broadcast on each of the known local interfaces listed in the
285\fIinterfaces\fR
286parameter\&. This is the least reliable of the name resolution methods as it depends on the target host being on a locally connected subnet\&.
287.sp
288.RE
289If this parameter is not set then the name resolve order defined in the
290\fBsmb.conf\fR(5)
291file parameter (name resolve order) will be used\&.
292.sp
293The default order is lmhosts, host, wins, bcast and without this parameter or any entry in the
294\fIname resolve order \fR
295parameter of the
296\fBsmb.conf\fR(5)
297file the name resolution methods will be attempted in this order\&.
298.RE
299.PP
300\-M NetBIOS name
301.RS 4
302This options allows you to send messages, using the "WinPopup" protocol, to another computer\&. Once a connection is established you then type your message, pressing ^D (control\-D) to end\&.
303.sp
304If the receiving computer is running WinPopup the user will receive the message and probably a beep\&. If they are not running WinPopup the message will be lost, and no error message will occur\&.
305.sp
306The message is also automatically truncated if the message is over 1600 bytes, as this is the limit of the protocol\&.
307.sp
308One useful trick is to pipe the message through
309\FCsmbclient\F[]\&. For example: smbclient \-M FRED < mymessage\&.txt will send the message in the file
310\FCmymessage\&.txt\F[]
311to the machine FRED\&.
312.sp
313You may also find the
314\fI\-U\fR
315and
316\fI\-I\fR
317options useful, as they allow you to control the FROM and TO parts of the message\&.
318.sp
319See the
320\fImessage command\fR
321parameter in the
322\fBsmb.conf\fR(5)
323for a description of how to handle incoming WinPopup messages in Samba\&.
324.sp
325\fINote\fR: Copy WinPopup into the startup group on your WfWg PCs if you want them to always be able to receive messages\&.
326.RE
327.PP
328\-p port
329.RS 4
330This number is the TCP port number that will be used when making connections to the server\&. The standard (well\-known) TCP port number for an SMB/CIFS server is 139, which is the default\&.
331.RE
332.PP
333\-g
334.RS 4
335This parameter provides combined with
336\fI\-L\fR
337easy parseable output that allows processing with utilities such as grep and cut\&.
338.RE
339.PP
340\-P
341.RS 4
342Make queries to the external server using the machine account of the local server\&.
343.RE
344.PP
345\-h|\-\-help
346.RS 4
347Print a summary of command line options\&.
348.RE
349.PP
350\-I IP\-address
351.RS 4
352\fIIP address\fR
353is the address of the server to connect to\&. It should be specified in standard "a\&.b\&.c\&.d" notation\&.
354.sp
355Normally the client would attempt to locate a named SMB/CIFS server by looking it up via the NetBIOS name resolution mechanism described above in the
356\fIname resolve order\fR
357parameter above\&. Using this parameter will force the client to assume that the server is on the machine with the specified IP address and the NetBIOS name component of the resource being connected to will be ignored\&.
358.sp
359There is no default for this parameter\&. If not supplied, it will be determined automatically by the client as described above\&.
360.RE
361.PP
362\-E
363.RS 4
364This parameter causes the client to write messages to the standard error stream (stderr) rather than to the standard output stream\&.
365.sp
366By default, the client writes messages to standard output \- typically the user\'s tty\&.
367.RE
368.PP
369\-L
370.RS 4
371This option allows you to look at what services are available on a server\&. You use it as
372\FCsmbclient \-L host\F[]
373and a list should appear\&. The
374\fI\-I \fR
375option may be useful if your NetBIOS names don\'t match your TCP/IP DNS host names or if you are trying to reach a host on another network\&.
376.RE
377.PP
378\-t terminal code
379.RS 4
380This option tells
381\FCsmbclient\F[]
382how to interpret filenames coming from the remote server\&. Usually Asian language multibyte UNIX implementations use different character sets than SMB/CIFS servers (\fIEUC\fR
383instead of
384\fI SJIS\fR
385for example)\&. Setting this parameter will let
386\FCsmbclient\F[]
387convert between the UNIX filenames and the SMB filenames correctly\&. This option has not been seriously tested and may have some problems\&.
388.sp
389The terminal codes include CWsjis, CWeuc, CWjis7, CWjis8, CWjunet, CWhex, CWcap\&. This is not a complete list, check the Samba source code for the complete list\&.
390.RE
391.PP
392\-b buffersize
393.RS 4
394This option changes the transmit/send buffer size when getting or putting a file from/to the server\&. The default is 65520 bytes\&. Setting this value smaller (to 1200 bytes) has been observed to speed up file transfers to and from a Win9x server\&.
395.RE
396.PP
397\-e
398.RS 4
399This command line parameter requires the remote server support the UNIX extensions\&. Request that the connection be encrypted\&. This is new for Samba 3\&.2 and will only work with Samba 3\&.2 or above servers\&. Negotiates SMB encryption using GSSAPI\&. Uses the given credentials for the encryption negotiaion (either kerberos or NTLMv1/v2 if given domain/username/password triple\&. Fails the connection if encryption cannot be negotiated\&.
400.RE
401.PP
402\-d|\-\-debuglevel=level
403.RS 4
404\fIlevel\fR
405is an integer from 0 to 10\&. The default value if this parameter is not specified is 1\&.
406.sp
407The higher this value, the more detail will be logged to the log files about the activities of the server\&. At level 0, only critical errors and serious warnings will be logged\&. Level 1 is a reasonable level for day\-to\-day running \- it generates a small amount of information about operations carried out\&.
408.sp
409Levels above 1 will generate considerable amounts of log data, and should only be used when investigating a problem\&. Levels above 3 are designed for use only by developers and generate HUGE amounts of log data, most of which is extremely cryptic\&.
410.sp
411Note that specifying this parameter here will override the
412\m[blue]\fBlog level\fR\m[]
413parameter in the
414\FCsmb\&.conf\F[]
415file\&.
416.RE
417.PP
418\-V
419.RS 4
420Prints the program version number\&.
421.RE
422.PP
423\-s <configuration file>
424.RS 4
425The file specified contains the configuration details required by the server\&. The information in this file includes server\-specific information such as what printcap file to use, as well as descriptions of all the services that the server is to provide\&. See
426\FCsmb\&.conf\F[]
427for more information\&. The default configuration file name is determined at compile time\&.
428.RE
429.PP
430\-l|\-\-log\-basename=logdirectory
431.RS 4
432Base directory name for log/debug files\&. The extension
433\fB"\&.progname"\fR
434will be appended (e\&.g\&. log\&.smbclient, log\&.smbd, etc\&.\&.\&.)\&. The log file is never removed by the client\&.
435.RE
436.PP
437\-N
438.RS 4
439If specified, this parameter suppresses the normal password prompt from the client to the user\&. This is useful when accessing a service that does not require a password\&.
440.sp
441Unless a password is specified on the command line or this parameter is specified, the client will request a password\&.
442.sp
443If a password is specified on the command line and this option is also defined the password on the command line will be silently ingnored and no password will be used\&.
444.RE
445.PP
446\-k
447.RS 4
448Try to authenticate with kerberos\&. Only useful in an Active Directory environment\&.
449.RE
450.PP
451\-A|\-\-authentication\-file=filename
452.RS 4
453This option allows you to specify a file from which to read the username and password used in the connection\&. The format of the file is
454.sp
455.if n \{\
456.RS 4
457.\}
458.fam C
459.ps -1
460.nf
461.if t \{\
462.sp -1
463.\}
464.BB lightgray adjust-for-leading-newline
465.sp -1
466
467username = <value>
468password = <value>
469domain = <value>
470.EB lightgray adjust-for-leading-newline
471.if t \{\
472.sp 1
473.\}
474.fi
475.fam
476.ps +1
477.if n \{\
478.RE
479.\}
480.sp
481Make certain that the permissions on the file restrict access from unwanted users\&.
482.RE
483.PP
484\-U|\-\-user=username[%password]
485.RS 4
486Sets the SMB username or username and password\&.
487.sp
488If %password is not specified, the user will be prompted\&. The client will first check the
489\fBUSER\fR
490environment variable, then the
491\fBLOGNAME\fR
492variable and if either exists, the string is uppercased\&. If these environmental variables are not found, the username
493\fBGUEST\fR
494is used\&.
495.sp
496A third option is to use a credentials file which contains the plaintext of the username and password\&. This option is mainly provided for scripts where the admin does not wish to pass the credentials on the command line or via environment variables\&. If this method is used, make certain that the permissions on the file restrict access from unwanted users\&. See the
497\fI\-A\fR
498for more details\&.
499.sp
500Be cautious about including passwords in scripts\&. Also, on many systems the command line of a running process may be seen via the
501\FCps\F[]
502command\&. To be safe always allow
503\FCrpcclient\F[]
504to prompt for a password and type it in directly\&.
505.RE
506.PP
507\-n <primary NetBIOS name>
508.RS 4
509This option allows you to override the NetBIOS name that Samba uses for itself\&. This is identical to setting the
510\m[blue]\fBnetbios name\fR\m[]
511parameter in the
512\FCsmb\&.conf\F[]
513file\&. However, a command line setting will take precedence over settings in
514\FCsmb\&.conf\F[]\&.
515.RE
516.PP
517\-i <scope>
518.RS 4
519This specifies a NetBIOS scope that
520\FCnmblookup\F[]
521will use to communicate with when generating NetBIOS names\&. For details on the use of NetBIOS scopes, see rfc1001\&.txt and rfc1002\&.txt\&. NetBIOS scopes are
522\fIvery\fR
523rarely used, only set this parameter if you are the system administrator in charge of all the NetBIOS systems you communicate with\&.
524.RE
525.PP
526\-W|\-\-workgroup=domain
527.RS 4
528Set the SMB domain of the username\&. This overrides the default domain which is the domain defined in smb\&.conf\&. If the domain specified is the same as the servers NetBIOS name, it causes the client to log on using the servers local SAM (as opposed to the Domain SAM)\&.
529.RE
530.PP
531\-O socket options
532.RS 4
533TCP socket options to set on the client socket\&. See the socket options parameter in the
534\FCsmb\&.conf\F[]
535manual page for the list of valid options\&.
536.RE
537.PP
538\-T tar options
539.RS 4
540smbclient may be used to create
541\FCtar(1) \F[]
542compatible backups of all the files on an SMB/CIFS share\&. The secondary tar flags that can be given to this option are :
543.sp
544.RS 4
545.ie n \{\
546\h'-04'\(bu\h'+03'\c
547.\}
548.el \{\
549.sp -1
550.IP \(bu 2.3
551.\}
552\fIc\fR
553\- Create a tar file on UNIX\&. Must be followed by the name of a tar file, tape device or "\-" for standard output\&. If using standard output you must turn the log level to its lowest value \-d0 to avoid corrupting your tar file\&. This flag is mutually exclusive with the
554\fIx\fR
555flag\&.
556.RE
557.sp
558.RS 4
559.ie n \{\
560\h'-04'\(bu\h'+03'\c
561.\}
562.el \{\
563.sp -1
564.IP \(bu 2.3
565.\}
566\fIx\fR
567\- Extract (restore) a local tar file back to a share\&. Unless the \-D option is given, the tar files will be restored from the top level of the share\&. Must be followed by the name of the tar file, device or "\-" for standard input\&. Mutually exclusive with the
568\fIc\fR
569flag\&. Restored files have their creation times (mtime) set to the date saved in the tar file\&. Directories currently do not get their creation dates restored properly\&.
570.RE
571.sp
572.RS 4
573.ie n \{\
574\h'-04'\(bu\h'+03'\c
575.\}
576.el \{\
577.sp -1
578.IP \(bu 2.3
579.\}
580\fII\fR
581\- Include files and directories\&. Is the default behavior when filenames are specified above\&. Causes files to be included in an extract or create (and therefore everything else to be excluded)\&. See example below\&. Filename globbing works in one of two ways\&. See
582\fIr\fR
583below\&.
584.RE
585.sp
586.RS 4
587.ie n \{\
588\h'-04'\(bu\h'+03'\c
589.\}
590.el \{\
591.sp -1
592.IP \(bu 2.3
593.\}
594\fIX\fR
595\- Exclude files and directories\&. Causes files to be excluded from an extract or create\&. See example below\&. Filename globbing works in one of two ways now\&. See
596\fIr\fR
597below\&.
598.RE
599.sp
600.RS 4
601.ie n \{\
602\h'-04'\(bu\h'+03'\c
603.\}
604.el \{\
605.sp -1
606.IP \(bu 2.3
607.\}
608\fIF\fR
609\- File containing a list of files and directories\&. The
610\fIF\fR
611causes the name following the tarfile to create to be read as a filename that contains a list of files and directories to be included in an extract or create (and therefore everything else to be excluded)\&. See example below\&. Filename globbing works in one of two ways\&. See
612\fIr\fR
613below\&.
614.RE
615.sp
616.RS 4
617.ie n \{\
618\h'-04'\(bu\h'+03'\c
619.\}
620.el \{\
621.sp -1
622.IP \(bu 2.3
623.\}
624\fIb\fR
625\- Blocksize\&. Must be followed by a valid (greater than zero) blocksize\&. Causes tar file to be written out in blocksize*TBLOCK (usually 512 byte) blocks\&.
626.RE
627.sp
628.RS 4
629.ie n \{\
630\h'-04'\(bu\h'+03'\c
631.\}
632.el \{\
633.sp -1
634.IP \(bu 2.3
635.\}
636\fIg\fR
637\- Incremental\&. Only back up files that have the archive bit set\&. Useful only with the
638\fIc\fR
639flag\&.
640.RE
641.sp
642.RS 4
643.ie n \{\
644\h'-04'\(bu\h'+03'\c
645.\}
646.el \{\
647.sp -1
648.IP \(bu 2.3
649.\}
650\fIq\fR
651\- Quiet\&. Keeps tar from printing diagnostics as it works\&. This is the same as tarmode quiet\&.
652.RE
653.sp
654.RS 4
655.ie n \{\
656\h'-04'\(bu\h'+03'\c
657.\}
658.el \{\
659.sp -1
660.IP \(bu 2.3
661.\}
662\fIr\fR
663\- Regular expression include or exclude\&. Uses regular expression matching for excluding or excluding files if compiled with HAVE_REGEX_H\&. However this mode can be very slow\&. If not compiled with HAVE_REGEX_H, does a limited wildcard match on \'*\' and \'?\'\&.
664.RE
665.sp
666.RS 4
667.ie n \{\
668\h'-04'\(bu\h'+03'\c
669.\}
670.el \{\
671.sp -1
672.IP \(bu 2.3
673.\}
674\fIN\fR
675\- Newer than\&. Must be followed by the name of a file whose date is compared against files found on the share during a create\&. Only files newer than the file specified are backed up to the tar file\&. Useful only with the
676\fIc\fR
677flag\&.
678.RE
679.sp
680.RS 4
681.ie n \{\
682\h'-04'\(bu\h'+03'\c
683.\}
684.el \{\
685.sp -1
686.IP \(bu 2.3
687.\}
688\fIa\fR
689\- Set archive bit\&. Causes the archive bit to be reset when a file is backed up\&. Useful with the
690\fIg\fR
691and
692\fIc\fR
693flags\&.
694.sp
695.RE
696\fITar Long File Names\fR
697.sp
698\FCsmbclient\F[]\'s tar option now supports long file names both on backup and restore\&. However, the full path name of the file must be less than 1024 bytes\&. Also, when a tar archive is created,
699\FCsmbclient\F[]\'s tar option places all files in the archive with relative names, not absolute names\&.
700.sp
701\fITar Filenames\fR
702.sp
703All file names can be given as DOS path names (with \'\e\e\' as the component separator) or as UNIX path names (with \'/\' as the component separator)\&.
704.sp
705\fIExamples\fR
706.sp
707Restore from tar file
708\FCbackup\&.tar\F[]
709into myshare on mypc (no password on share)\&.
710.sp
711\FCsmbclient //mypc/yshare "" \-N \-Tx backup\&.tar \F[]
712.sp
713Restore everything except
714\FCusers/docs\F[]
715.sp
716\FCsmbclient //mypc/myshare "" \-N \-TXx backup\&.tar users/docs\F[]
717.sp
718Create a tar file of the files beneath
719\FC users/docs\F[]\&.
720.sp
721\FCsmbclient //mypc/myshare "" \-N \-Tc backup\&.tar users/docs \F[]
722.sp
723Create the same tar file as above, but now use a DOS path name\&.
724.sp
725\FCsmbclient //mypc/myshare "" \-N \-tc backup\&.tar users\eedocs \F[]
726.sp
727Create a tar file of the files listed in the file
728\FCtarlist\F[]\&.
729.sp
730\FCsmbclient //mypc/myshare "" \-N \-TcF backup\&.tar tarlist\F[]
731.sp
732Create a tar file of all the files and directories in the share\&.
733.sp
734\FCsmbclient //mypc/myshare "" \-N \-Tc backup\&.tar * \F[]
735.RE
736.PP
737\-D initial directory
738.RS 4
739Change to initial directory before starting\&. Probably only of any use with the tar \-T option\&.
740.RE
741.PP
742\-c command string
743.RS 4
744command string is a semicolon\-separated list of commands to be executed instead of prompting from stdin\&.
745\fI \-N\fR
746is implied by
747\fI\-c\fR\&.
748.sp
749This is particularly useful in scripts and for printing stdin to the server, e\&.g\&.
750\FC\-c \'print \-\'\F[]\&.
751.RE
752.SH "OPERATIONS"
753.PP
754Once the client is running, the user is presented with a prompt :
755.PP
756\FCsmb:\e> \F[]
757.PP
758The backslash ("\e\e") indicates the current working directory on the server, and will change if the current working directory is changed\&.
759.PP
760The prompt indicates that the client is ready and waiting to carry out a user command\&. Each command is a single word, optionally followed by parameters specific to that command\&. Command and parameters are space\-delimited unless these notes specifically state otherwise\&. All commands are case\-insensitive\&. Parameters to commands may or may not be case sensitive, depending on the command\&.
761.PP
762You can specify file names which have spaces in them by quoting the name with double quotes, for example "a long file name"\&.
763.PP
764Parameters shown in square brackets (e\&.g\&., "[parameter]") are optional\&. If not given, the command will use suitable defaults\&. Parameters shown in angle brackets (e\&.g\&., "<parameter>") are required\&.
765.PP
766Note that all commands operating on the server are actually performed by issuing a request to the server\&. Thus the behavior may vary from server to server, depending on how the server was implemented\&.
767.PP
768The commands available are given here in alphabetical order\&.
769.PP
770? [command]
771.RS 4
772If
773\fIcommand\fR
774is specified, the ? command will display a brief informative message about the specified command\&. If no command is specified, a list of available commands will be displayed\&.
775.RE
776.PP
777! [shell command]
778.RS 4
779If
780\fIshell command\fR
781is specified, the ! command will execute a shell locally and run the specified shell command\&. If no command is specified, a local shell will be run\&.
782.RE
783.PP
784allinfo file
785.RS 4
786The client will request that the server return all known information about a file or directory (including streams)\&.
787.RE
788.PP
789altname file
790.RS 4
791The client will request that the server return the "alternate" name (the 8\&.3 name) for a file or directory\&.
792.RE
793.PP
794archive <number>
795.RS 4
796Sets the archive level when operating on files\&. 0 means ignore the archive bit, 1 means only operate on files with this bit set, 2 means only operate on files with this bit set and reset it after operation, 3 means operate on all files and reset it after operation\&. The default is 0\&.
797.RE
798.PP
799blocksize <number>
800.RS 4
801Sets the blocksize parameter for a tar operation\&. The default is 20\&. Causes tar file to be written out in blocksize*TBLOCK (normally 512 byte) units\&.
802.RE
803.PP
804cancel jobid0 [jobid1] \&.\&.\&. [jobidN]
805.RS 4
806The client will request that the server cancel the printjobs identified by the given numeric print job ids\&.
807.RE
808.PP
809case_sensitive
810.RS 4
811Toggles the setting of the flag in SMB packets that tells the server to treat filenames as case sensitive\&. Set to OFF by default (tells file server to treat filenames as case insensitive)\&. Only currently affects Samba 3\&.0\&.5 and above file servers with the case sensitive parameter set to auto in the smb\&.conf\&.
812.RE
813.PP
814cd <directory name>
815.RS 4
816If "directory name" is specified, the current working directory on the server will be changed to the directory specified\&. This operation will fail if for any reason the specified directory is inaccessible\&.
817.sp
818If no directory name is specified, the current working directory on the server will be reported\&.
819.RE
820.PP
821chmod file mode in octal
822.RS 4
823This command depends on the server supporting the CIFS UNIX extensions and will fail if the server does not\&. The client requests that the server change the UNIX permissions to the given octal mode, in standard UNIX format\&.
824.RE
825.PP
826chown file uid gid
827.RS 4
828This command depends on the server supporting the CIFS UNIX extensions and will fail if the server does not\&. The client requests that the server change the UNIX user and group ownership to the given decimal values\&. Note there is currently no way to remotely look up the UNIX uid and gid values for a given name\&. This may be addressed in future versions of the CIFS UNIX extensions\&.
829.RE
830.PP
831close <fileid>
832.RS 4
833Closes a file explicitly opened by the open command\&. Used for internal Samba testing purposes\&.
834.RE
835.PP
836del <mask>
837.RS 4
838The client will request that the server attempt to delete all files matching
839\fImask\fR
840from the current working directory on the server\&.
841.RE
842.PP
843dir <mask>
844.RS 4
845A list of the files matching
846\fImask\fR
847in the current working directory on the server will be retrieved from the server and displayed\&.
848.RE
849.PP
850du <filename>
851.RS 4
852Does a directory listing and then prints out the current disk useage and free space on a share\&.
853.RE
854.PP
855echo <number> <data>
856.RS 4
857Does an SMBecho request to ping the server\&. Used for internal Samba testing purposes\&.
858.RE
859.PP
860exit
861.RS 4
862Terminate the connection with the server and exit from the program\&.
863.RE
864.PP
865get <remote file name> [local file name]
866.RS 4
867Copy the file called
868\FCremote file name\F[]
869from the server to the machine running the client\&. If specified, name the local copy
870\FClocal file name\F[]\&. Note that all transfers in
871\FCsmbclient\F[]
872are binary\&. See also the lowercase command\&.
873.RE
874.PP
875getfacl <filename>
876.RS 4
877Requires the server support the UNIX extensions\&. Requests and prints the POSIX ACL on a file\&.
878.RE
879.PP
880hardlink <src> <dest>
881.RS 4
882Creates a hardlink on the server using Windows CIFS semantics\&.
883.RE
884.PP
885help [command]
886.RS 4
887See the ? command above\&.
888.RE
889.PP
890history
891.RS 4
892Displays the command history\&.
893.RE
894.PP
895iosize <bytes>
896.RS 4
897When sending or receiving files, smbclient uses an internal memory buffer by default of size 64512 bytes\&. This command allows this size to be set to any range between 16384 (0x4000) bytes and 16776960 (0xFFFF00) bytes\&. Larger sizes may mean more efficient data transfer as smbclient will try and use the most efficient read and write calls for the connected server\&.
898.RE
899.PP
900lcd [directory name]
901.RS 4
902If
903\fIdirectory name\fR
904is specified, the current working directory on the local machine will be changed to the directory specified\&. This operation will fail if for any reason the specified directory is inaccessible\&.
905.sp
906If no directory name is specified, the name of the current working directory on the local machine will be reported\&.
907.RE
908.PP
909link target linkname
910.RS 4
911This command depends on the server supporting the CIFS UNIX extensions and will fail if the server does not\&. The client requests that the server create a hard link between the linkname and target files\&. The linkname file must not exist\&.
912.RE
913.PP
914listconnect
915.RS 4
916Show the current connections held for DFS purposes\&.
917.RE
918.PP
919lock <filenum> <r|w> <hex\-start> <hex\-len>
920.RS 4
921This command depends on the server supporting the CIFS UNIX extensions and will fail if the server does not\&. Tries to set a POSIX fcntl lock of the given type on the given range\&. Used for internal Samba testing purposes\&.
922.RE
923.PP
924logon <username> <password>
925.RS 4
926Establishes a new vuid for this session by logging on again\&. Replaces the current vuid\&. Prints out the new vuid\&. Used for internal Samba testing purposes\&.
927.RE
928.PP
929lowercase
930.RS 4
931Toggle lowercasing of filenames for the get and mget commands\&.
932.sp
933When lowercasing is toggled ON, local filenames are converted to lowercase when using the get and mget commands\&. This is often useful when copying (say) MSDOS files from a server, because lowercase filenames are the norm on UNIX systems\&.
934.RE
935.PP
936ls <mask>
937.RS 4
938See the dir command above\&.
939.RE
940.PP
941mask <mask>
942.RS 4
943This command allows the user to set up a mask which will be used during recursive operation of the mget and mput commands\&.
944.sp
945The masks specified to the mget and mput commands act as filters for directories rather than files when recursion is toggled ON\&.
946.sp
947The mask specified with the mask command is necessary to filter files within those directories\&. For example, if the mask specified in an mget command is "source*" and the mask specified with the mask command is "*\&.c" and recursion is toggled ON, the mget command will retrieve all files matching "*\&.c" in all directories below and including all directories matching "source*" in the current working directory\&.
948.sp
949Note that the value for mask defaults to blank (equivalent to "*") and remains so until the mask command is used to change it\&. It retains the most recently specified value indefinitely\&. To avoid unexpected results it would be wise to change the value of mask back to "*" after using the mget or mput commands\&.
950.RE
951.PP
952md <directory name>
953.RS 4
954See the mkdir command\&.
955.RE
956.PP
957mget <mask>
958.RS 4
959Copy all files matching
960\fImask\fR
961from the server to the machine running the client\&.
962.sp
963Note that
964\fImask\fR
965is interpreted differently during recursive operation and non\-recursive operation \- refer to the recurse and mask commands for more information\&. Note that all transfers in
966\FCsmbclient\F[]
967are binary\&. See also the lowercase command\&.
968.RE
969.PP
970mkdir <directory name>
971.RS 4
972Create a new directory on the server (user access privileges permitting) with the specified name\&.
973.RE
974.PP
975more <file name>
976.RS 4
977Fetch a remote file and view it with the contents of your PAGER environment variable\&.
978.RE
979.PP
980mput <mask>
981.RS 4
982Copy all files matching
983\fImask\fR
984in the current working directory on the local machine to the current working directory on the server\&.
985.sp
986Note that
987\fImask\fR
988is interpreted differently during recursive operation and non\-recursive operation \- refer to the recurse and mask commands for more information\&. Note that all transfers in
989\FCsmbclient\F[]
990are binary\&.
991.RE
992.PP
993posix
994.RS 4
995Query the remote server to see if it supports the CIFS UNIX extensions and prints out the list of capabilities supported\&. If so, turn on POSIX pathname processing and large file read/writes (if available),\&.
996.RE
997.PP
998posix_encrypt <domain> <username> <password>
999.RS 4
1000This command depends on the server supporting the CIFS UNIX extensions and will fail if the server does not\&. Attempt to negotiate SMB encryption on this connection\&. If smbclient connected with kerberos credentials (\-k) the arguments to this command are ignored and the kerberos credentials are used to negotiate GSSAPI signing and sealing instead\&. See also the \-e option to smbclient to force encryption on initial connection\&. This command is new with Samba 3\&.2\&.
1001.RE
1002.PP
1003posix_open <filename> <octal mode>
1004.RS 4
1005This command depends on the server supporting the CIFS UNIX extensions and will fail if the server does not\&. Opens a remote file using the CIFS UNIX extensions and prints a fileid\&. Used for internal Samba testing purposes\&.
1006.RE
1007.PP
1008posix_mkdir <directoryname> <octal mode>
1009.RS 4
1010This command depends on the server supporting the CIFS UNIX extensions and will fail if the server does not\&. Creates a remote directory using the CIFS UNIX extensions with the given mode\&.
1011.RE
1012.PP
1013posix_rmdir <directoryname>
1014.RS 4
1015This command depends on the server supporting the CIFS UNIX extensions and will fail if the server does not\&. Deletes a remote directory using the CIFS UNIX extensions\&.
1016.RE
1017.PP
1018posix_unlink <filename>
1019.RS 4
1020This command depends on the server supporting the CIFS UNIX extensions and will fail if the server does not\&. Deletes a remote file using the CIFS UNIX extensions\&.
1021.RE
1022.PP
1023print <file name>
1024.RS 4
1025Print the specified file from the local machine through a printable service on the server\&.
1026.RE
1027.PP
1028prompt
1029.RS 4
1030Toggle prompting for filenames during operation of the mget and mput commands\&.
1031.sp
1032When toggled ON, the user will be prompted to confirm the transfer of each file during these commands\&. When toggled OFF, all specified files will be transferred without prompting\&.
1033.RE
1034.PP
1035put <local file name> [remote file name]
1036.RS 4
1037Copy the file called
1038\FClocal file name\F[]
1039from the machine running the client to the server\&. If specified, name the remote copy
1040\FCremote file name\F[]\&. Note that all transfers in
1041\FCsmbclient\F[]
1042are binary\&. See also the lowercase command\&.
1043.RE
1044.PP
1045queue
1046.RS 4
1047Displays the print queue, showing the job id, name, size and current status\&.
1048.RE
1049.PP
1050quit
1051.RS 4
1052See the exit command\&.
1053.RE
1054.PP
1055rd <directory name>
1056.RS 4
1057See the rmdir command\&.
1058.RE
1059.PP
1060recurse
1061.RS 4
1062Toggle directory recursion for the commands mget and mput\&.
1063.sp
1064When toggled ON, these commands will process all directories in the source directory (i\&.e\&., the directory they are copying from ) and will recurse into any that match the mask specified to the command\&. Only files that match the mask specified using the mask command will be retrieved\&. See also the mask command\&.
1065.sp
1066When recursion is toggled OFF, only files from the current working directory on the source machine that match the mask specified to the mget or mput commands will be copied, and any mask specified using the mask command will be ignored\&.
1067.RE
1068.PP
1069rename <old filename> <new filename>
1070.RS 4
1071Rename files in the current working directory on the server from
1072\fIold filename\fR
1073to
1074\fInew filename\fR\&.
1075.RE
1076.PP
1077rm <mask>
1078.RS 4
1079Remove all files matching
1080\fImask\fR
1081from the current working directory on the server\&.
1082.RE
1083.PP
1084rmdir <directory name>
1085.RS 4
1086Remove the specified directory (user access privileges permitting) from the server\&.
1087.RE
1088.PP
1089setmode <filename> <perm=[+|\e\-]rsha>
1090.RS 4
1091A version of the DOS attrib command to set file permissions\&. For example:
1092.sp
1093\FCsetmode myfile +r \F[]
1094.sp
1095would make myfile read only\&.
1096.RE
1097.PP
1098showconnect
1099.RS 4
1100Show the currently active connection held for DFS purposes\&.
1101.RE
1102.PP
1103stat file
1104.RS 4
1105This command depends on the server supporting the CIFS UNIX extensions and will fail if the server does not\&. The client requests the UNIX basic info level and prints out the same info that the Linux stat command would about the file\&. This includes the size, blocks used on disk, file type, permissions, inode number, number of links and finally the three timestamps (access, modify and change)\&. If the file is a special file (symlink, character or block device, fifo or socket) then extra information may also be printed\&.
1106.RE
1107.PP
1108symlink target linkname
1109.RS 4
1110This command depends on the server supporting the CIFS UNIX extensions and will fail if the server does not\&. The client requests that the server create a symbolic hard link between the target and linkname files\&. The linkname file must not exist\&. Note that the server will not create a link to any path that lies outside the currently connected share\&. This is enforced by the Samba server\&.
1111.RE
1112.PP
1113tar <c|x>[IXbgNa]
1114.RS 4
1115Performs a tar operation \- see the
1116\fI\-T \fR
1117command line option above\&. Behavior may be affected by the tarmode command (see below)\&. Using g (incremental) and N (newer) will affect tarmode settings\&. Note that using the "\-" option with tar x may not work \- use the command line option instead\&.
1118.RE
1119.PP
1120blocksize <blocksize>
1121.RS 4
1122Blocksize\&. Must be followed by a valid (greater than zero) blocksize\&. Causes tar file to be written out in
1123\fIblocksize\fR*TBLOCK (usually 512 byte) blocks\&.
1124.RE
1125.PP
1126tarmode <full|inc|reset|noreset>
1127.RS 4
1128Changes tar\'s behavior with regard to archive bits\&. In full mode, tar will back up everything regardless of the archive bit setting (this is the default mode)\&. In incremental mode, tar will only back up files with the archive bit set\&. In reset mode, tar will reset the archive bit on all files it backs up (implies read/write share)\&.
1129.RE
1130.PP
1131unlock <filenum> <hex\-start> <hex\-len>
1132.RS 4
1133This command depends on the server supporting the CIFS UNIX extensions and will fail if the server does not\&. Tries to unlock a POSIX fcntl lock on the given range\&. Used for internal Samba testing purposes\&.
1134.RE
1135.PP
1136volume
1137.RS 4
1138Prints the current volume name of the share\&.
1139.RE
1140.PP
1141vuid <number>
1142.RS 4
1143Changes the currently used vuid in the protocol to the given arbitrary number\&. Without an argument prints out the current vuid being used\&. Used for internal Samba testing purposes\&.
1144.RE
1145.SH "NOTES"
1146.PP
1147Some servers are fussy about the case of supplied usernames, passwords, share names (AKA service names) and machine names\&. If you fail to connect try giving all parameters in uppercase\&.
1148.PP
1149It is often necessary to use the \-n option when connecting to some types of servers\&. For example OS/2 LanManager insists on a valid NetBIOS name being used, so you need to supply a valid name that would be known to the server\&.
1150.PP
1151smbclient supports long file names where the server supports the LANMAN2 protocol or above\&.
1152.SH "ENVIRONMENT VARIABLES"
1153.PP
1154The variable
1155\fBUSER\fR
1156may contain the username of the person using the client\&. This information is used only if the protocol level is high enough to support session\-level passwords\&.
1157.PP
1158The variable
1159\fBPASSWD\fR
1160may contain the password of the person using the client\&. This information is used only if the protocol level is high enough to support session\-level passwords\&.
1161.PP
1162The variable
1163\fBLIBSMB_PROG\fR
1164may contain the path, executed with system(), which the client should connect to instead of connecting to a server\&. This functionality is primarily intended as a development aid, and works best when using a LMHOSTS file
1165.SH "INSTALLATION"
1166.PP
1167The location of the client program is a matter for individual system administrators\&. The following are thus suggestions only\&.
1168.PP
1169It is recommended that the smbclient software be installed in the
1170\FC/usr/local/samba/bin/\F[]
1171or
1172\FC /usr/samba/bin/\F[]
1173directory, this directory readable by all, writeable only by root\&. The client program itself should be executable by all\&. The client should
1174\fINOT\fR
1175be setuid or setgid!
1176.PP
1177The client log files should be put in a directory readable and writeable only by the user\&.
1178.PP
1179To test the client, you will need to know the name of a running SMB/CIFS server\&. It is possible to run
1180\fBsmbd\fR(8)
1181as an ordinary user \- running that server as a daemon on a user\-accessible port (typically any port number over 1024) would provide a suitable test server\&.
1182.SH "DIAGNOSTICS"
1183.PP
1184Most diagnostics issued by the client are logged in a specified log file\&. The log file name is specified at compile time, but may be overridden on the command line\&.
1185.PP
1186The number and nature of diagnostics available depends on the debug level used by the client\&. If you have problems, set the debug level to 3 and peruse the log files\&.
1187.SH "VERSION"
1188.PP
1189This man page is correct for version 3\&.2 of the Samba suite\&.
1190.SH "AUTHOR"
1191.PP
1192The original Samba software and related utilities were created by Andrew Tridgell\&. Samba is now developed by the Samba Team as an Open Source project similar to the way the Linux kernel is developed\&.
1193.PP
1194The original Samba man pages were written by Karl Auer\&. The man page sources were converted to YODL format (another excellent piece of Open Source software, available at
1195ftp://ftp\&.icce\&.rug\&.nl/pub/unix/) and updated for the Samba 2\&.0 release by Jeremy Allison\&. The conversion to DocBook for Samba 2\&.2 was done by Gerald Carter\&. The conversion to DocBook XML 4\&.2 for Samba 3\&.0 was done by Alexander Bokovoy\&.
Note: See TracBrowser for help on using the repository browser.