source: vendor/3.5.7/docs/manpages/smbclient.1

Last change on this file was 478, checked in by Silvan Scherrer, 15 years ago

Samba 3.5: vendor update to 3.5.4

File size: 43.3 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: 06/18/2010
5.\" Manual: User Commands
6.\" Source: Samba 3.5
7.\" Language: English
8.\"
9.TH "SMBCLIENT" "1" "06/18/2010" "Samba 3\&.5" "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] [\-C] [\-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] [\-C] [\-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 <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|\-\-message 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 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|\-\-grepable
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\-m|\-\-max\-protocol protocol
341.RS 4
342This parameter sets the maximum protocol version announced by the client\&.
343.RE
344.PP
345\-P
346.RS 4
347Make queries to the external server using the machine account of the local server\&.
348.RE
349.PP
350\-h|\-\-help
351.RS 4
352Print a summary of command line options\&.
353.RE
354.PP
355\-I|\-\-ip\-address IP\-address
356.RS 4
357\fIIP address\fR
358is the address of the server to connect to\&. It should be specified in standard "a\&.b\&.c\&.d" notation\&.
359.sp
360Normally 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
361\fIname resolve order\fR
362parameter 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\&.
363.sp
364There is no default for this parameter\&. If not supplied, it will be determined automatically by the client as described above\&.
365.RE
366.PP
367\-E|\-\-stderr
368.RS 4
369This parameter causes the client to write messages to the standard error stream (stderr) rather than to the standard output stream\&.
370.sp
371By default, the client writes messages to standard output \- typically the user\'s tty\&.
372.RE
373.PP
374\-L|\-\-list
375.RS 4
376This option allows you to look at what services are available on a server\&. You use it as
377\FCsmbclient \-L host\F[]
378and a list should appear\&. The
379\fI\-I \fR
380option 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\&.
381.RE
382.PP
383\-b|\-\-send\-buffer buffersize
384.RS 4
385This 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\&.
386.RE
387.PP
388\-e
389.RS 4
390This 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\&.
391.RE
392.PP
393\-d|\-\-debuglevel=level
394.RS 4
395\fIlevel\fR
396is an integer from 0 to 10\&. The default value if this parameter is not specified is 1\&.
397.sp
398The 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\&.
399.sp
400Levels 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\&.
401.sp
402Note that specifying this parameter here will override the
403\m[blue]\fB\%smb.conf.5.html#\fR\m[]
404parameter in the
405\FCsmb\&.conf\F[]
406file\&.
407.RE
408.PP
409\-V|\-\-version
410.RS 4
411Prints the program version number\&.
412.RE
413.PP
414\-s|\-\-configfile <configuration file>
415.RS 4
416The 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
417\FCsmb\&.conf\F[]
418for more information\&. The default configuration file name is determined at compile time\&.
419.RE
420.PP
421\-l|\-\-log\-basename=logdirectory
422.RS 4
423Base directory name for log/debug files\&. The extension
424\fB"\&.progname"\fR
425will be appended (e\&.g\&. log\&.smbclient, log\&.smbd, etc\&.\&.\&.)\&. The log file is never removed by the client\&.
426.RE
427.PP
428\-N|\-\-no\-pass
429.RS 4
430If 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\&.
431.sp
432Unless a password is specified on the command line or this parameter is specified, the client will request a password\&.
433.sp
434If 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\&.
435.RE
436.PP
437\-k|\-\-kerberos
438.RS 4
439Try to authenticate with kerberos\&. Only useful in an Active Directory environment\&.
440.RE
441.PP
442\-C|\-\-use\-ccache
443.RS 4
444Try to use the credentials cached by winbind\&.
445.RE
446.PP
447\-A|\-\-authentication\-file=filename
448.RS 4
449This 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
450.sp
451.if n \{\
452.RS 4
453.\}
454.fam C
455.ps -1
456.nf
457.if t \{\
458.sp -1
459.\}
460.BB lightgray adjust-for-leading-newline
461.sp -1
462
463username = <value>
464password = <value>
465domain = <value>
466.EB lightgray adjust-for-leading-newline
467.if t \{\
468.sp 1
469.\}
470.fi
471.fam
472.ps +1
473.if n \{\
474.RE
475.\}
476.sp
477Make certain that the permissions on the file restrict access from unwanted users\&.
478.RE
479.PP
480\-U|\-\-user=username[%password]
481.RS 4
482Sets the SMB username or username and password\&.
483.sp
484If %password is not specified, the user will be prompted\&. The client will first check the
485\fBUSER\fR
486environment variable, then the
487\fBLOGNAME\fR
488variable and if either exists, the string is uppercased\&. If these environmental variables are not found, the username
489\fBGUEST\fR
490is used\&.
491.sp
492A 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
493\fI\-A\fR
494for more details\&.
495.sp
496Be cautious about including passwords in scripts\&. Also, on many systems the command line of a running process may be seen via the
497\FCps\F[]
498command\&. To be safe always allow
499\FCrpcclient\F[]
500to prompt for a password and type it in directly\&.
501.RE
502.PP
503\-n|\-\-netbiosname <primary NetBIOS name>
504.RS 4
505This option allows you to override the NetBIOS name that Samba uses for itself\&. This is identical to setting the
506\m[blue]\fB\%smb.conf.5.html#\fR\m[]
507parameter in the
508\FCsmb\&.conf\F[]
509file\&. However, a command line setting will take precedence over settings in
510\FCsmb\&.conf\F[]\&.
511.RE
512.PP
513\-i|\-\-scope <scope>
514.RS 4
515This specifies a NetBIOS scope that
516\FCnmblookup\F[]
517will 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
518\fIvery\fR
519rarely used, only set this parameter if you are the system administrator in charge of all the NetBIOS systems you communicate with\&.
520.RE
521.PP
522\-W|\-\-workgroup=domain
523.RS 4
524Set 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)\&.
525.RE
526.PP
527\-O|\-\-socket\-options socket options
528.RS 4
529TCP socket options to set on the client socket\&. See the socket options parameter in the
530\FCsmb\&.conf\F[]
531manual page for the list of valid options\&.
532.RE
533.PP
534\-T|\-\-tar tar options
535.RS 4
536smbclient may be used to create
537\FCtar(1) \F[]
538compatible backups of all the files on an SMB/CIFS share\&. The secondary tar flags that can be given to this option are :
539.sp
540.RS 4
541.ie n \{\
542\h'-04'\(bu\h'+03'\c
543.\}
544.el \{\
545.sp -1
546.IP \(bu 2.3
547.\}
548\fIc\fR
549\- 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
550\fIx\fR
551flag\&.
552.RE
553.sp
554.RS 4
555.ie n \{\
556\h'-04'\(bu\h'+03'\c
557.\}
558.el \{\
559.sp -1
560.IP \(bu 2.3
561.\}
562\fIx\fR
563\- 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
564\fIc\fR
565flag\&. 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\&.
566.RE
567.sp
568.RS 4
569.ie n \{\
570\h'-04'\(bu\h'+03'\c
571.\}
572.el \{\
573.sp -1
574.IP \(bu 2.3
575.\}
576\fII\fR
577\- 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
578\fIr\fR
579below\&.
580.RE
581.sp
582.RS 4
583.ie n \{\
584\h'-04'\(bu\h'+03'\c
585.\}
586.el \{\
587.sp -1
588.IP \(bu 2.3
589.\}
590\fIX\fR
591\- 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
592\fIr\fR
593below\&.
594.RE
595.sp
596.RS 4
597.ie n \{\
598\h'-04'\(bu\h'+03'\c
599.\}
600.el \{\
601.sp -1
602.IP \(bu 2.3
603.\}
604\fIF\fR
605\- File containing a list of files and directories\&. The
606\fIF\fR
607causes 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
608\fIr\fR
609below\&.
610.RE
611.sp
612.RS 4
613.ie n \{\
614\h'-04'\(bu\h'+03'\c
615.\}
616.el \{\
617.sp -1
618.IP \(bu 2.3
619.\}
620\fIb\fR
621\- 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\&.
622.RE
623.sp
624.RS 4
625.ie n \{\
626\h'-04'\(bu\h'+03'\c
627.\}
628.el \{\
629.sp -1
630.IP \(bu 2.3
631.\}
632\fIg\fR
633\- Incremental\&. Only back up files that have the archive bit set\&. Useful only with the
634\fIc\fR
635flag\&.
636.RE
637.sp
638.RS 4
639.ie n \{\
640\h'-04'\(bu\h'+03'\c
641.\}
642.el \{\
643.sp -1
644.IP \(bu 2.3
645.\}
646\fIq\fR
647\- Quiet\&. Keeps tar from printing diagnostics as it works\&. This is the same as tarmode quiet\&.
648.RE
649.sp
650.RS 4
651.ie n \{\
652\h'-04'\(bu\h'+03'\c
653.\}
654.el \{\
655.sp -1
656.IP \(bu 2.3
657.\}
658\fIr\fR
659\- 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 \'?\'\&.
660.RE
661.sp
662.RS 4
663.ie n \{\
664\h'-04'\(bu\h'+03'\c
665.\}
666.el \{\
667.sp -1
668.IP \(bu 2.3
669.\}
670\fIN\fR
671\- 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
672\fIc\fR
673flag\&.
674.RE
675.sp
676.RS 4
677.ie n \{\
678\h'-04'\(bu\h'+03'\c
679.\}
680.el \{\
681.sp -1
682.IP \(bu 2.3
683.\}
684\fIa\fR
685\- Set archive bit\&. Causes the archive bit to be reset when a file is backed up\&. Useful with the
686\fIg\fR
687and
688\fIc\fR
689flags\&.
690.sp
691.RE
692\fITar Long File Names\fR
693.sp
694\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,
695\FCsmbclient\F[]\'s tar option places all files in the archive with relative names, not absolute names\&.
696.sp
697\fITar Filenames\fR
698.sp
699All 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)\&.
700.sp
701\fIExamples\fR
702.sp
703Restore from tar file
704\FCbackup\&.tar\F[]
705into myshare on mypc (no password on share)\&.
706.sp
707\FCsmbclient //mypc/yshare "" \-N \-Tx backup\&.tar \F[]
708.sp
709Restore everything except
710\FCusers/docs\F[]
711.sp
712\FCsmbclient //mypc/myshare "" \-N \-TXx backup\&.tar users/docs\F[]
713.sp
714Create a tar file of the files beneath
715\FC users/docs\F[]\&.
716.sp
717\FCsmbclient //mypc/myshare "" \-N \-Tc backup\&.tar users/docs \F[]
718.sp
719Create the same tar file as above, but now use a DOS path name\&.
720.sp
721\FCsmbclient //mypc/myshare "" \-N \-tc backup\&.tar users\eedocs \F[]
722.sp
723Create a tar file of the files listed in the file
724\FCtarlist\F[]\&.
725.sp
726\FCsmbclient //mypc/myshare "" \-N \-TcF backup\&.tar tarlist\F[]
727.sp
728Create a tar file of all the files and directories in the share\&.
729.sp
730\FCsmbclient //mypc/myshare "" \-N \-Tc backup\&.tar * \F[]
731.RE
732.PP
733\-D|\-\-directory initial directory
734.RS 4
735Change to initial directory before starting\&. Probably only of any use with the tar \-T option\&.
736.RE
737.PP
738\-c|\-\-comand command string
739.RS 4
740command string is a semicolon\-separated list of commands to be executed instead of prompting from stdin\&.
741\fI \-N\fR
742is implied by
743\fI\-c\fR\&.
744.sp
745This is particularly useful in scripts and for printing stdin to the server, e\&.g\&.
746\FC\-c \'print \-\'\F[]\&.
747.RE
748.SH "OPERATIONS"
749.PP
750Once the client is running, the user is presented with a prompt :
751.PP
752\FCsmb:\e> \F[]
753.PP
754The backslash ("\e\e") indicates the current working directory on the server, and will change if the current working directory is changed\&.
755.PP
756The 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\&.
757.PP
758You can specify file names which have spaces in them by quoting the name with double quotes, for example "a long file name"\&.
759.PP
760Parameters 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\&.
761.PP
762Note 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\&.
763.PP
764The commands available are given here in alphabetical order\&.
765.PP
766? [command]
767.RS 4
768If
769\fIcommand\fR
770is 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\&.
771.RE
772.PP
773! [shell command]
774.RS 4
775If
776\fIshell command\fR
777is 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\&.
778.RE
779.PP
780allinfo file
781.RS 4
782The client will request that the server return all known information about a file or directory (including streams)\&.
783.RE
784.PP
785altname file
786.RS 4
787The client will request that the server return the "alternate" name (the 8\&.3 name) for a file or directory\&.
788.RE
789.PP
790archive <number>
791.RS 4
792Sets 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\&.
793.RE
794.PP
795blocksize <number>
796.RS 4
797Sets 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\&.
798.RE
799.PP
800cancel jobid0 [jobid1] \&.\&.\&. [jobidN]
801.RS 4
802The client will request that the server cancel the printjobs identified by the given numeric print job ids\&.
803.RE
804.PP
805case_sensitive
806.RS 4
807Toggles 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\&.
808.RE
809.PP
810cd <directory name>
811.RS 4
812If "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\&.
813.sp
814If no directory name is specified, the current working directory on the server will be reported\&.
815.RE
816.PP
817chmod file mode in octal
818.RS 4
819This 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\&.
820.RE
821.PP
822chown file uid gid
823.RS 4
824This 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\&.
825.RE
826.PP
827close <fileid>
828.RS 4
829Closes a file explicitly opened by the open command\&. Used for internal Samba testing purposes\&.
830.RE
831.PP
832del <mask>
833.RS 4
834The client will request that the server attempt to delete all files matching
835\fImask\fR
836from the current working directory on the server\&.
837.RE
838.PP
839dir <mask>
840.RS 4
841A list of the files matching
842\fImask\fR
843in the current working directory on the server will be retrieved from the server and displayed\&.
844.RE
845.PP
846du <filename>
847.RS 4
848Does a directory listing and then prints out the current disk useage and free space on a share\&.
849.RE
850.PP
851echo <number> <data>
852.RS 4
853Does an SMBecho request to ping the server\&. Used for internal Samba testing purposes\&.
854.RE
855.PP
856exit
857.RS 4
858Terminate the connection with the server and exit from the program\&.
859.RE
860.PP
861get <remote file name> [local file name]
862.RS 4
863Copy the file called
864\FCremote file name\F[]
865from the server to the machine running the client\&. If specified, name the local copy
866\FClocal file name\F[]\&. Note that all transfers in
867\FCsmbclient\F[]
868are binary\&. See also the lowercase command\&.
869.RE
870.PP
871getfacl <filename>
872.RS 4
873Requires the server support the UNIX extensions\&. Requests and prints the POSIX ACL on a file\&.
874.RE
875.PP
876hardlink <src> <dest>
877.RS 4
878Creates a hardlink on the server using Windows CIFS semantics\&.
879.RE
880.PP
881help [command]
882.RS 4
883See the ? command above\&.
884.RE
885.PP
886history
887.RS 4
888Displays the command history\&.
889.RE
890.PP
891iosize <bytes>
892.RS 4
893When 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\&.
894.RE
895.PP
896lcd [directory name]
897.RS 4
898If
899\fIdirectory name\fR
900is 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\&.
901.sp
902If no directory name is specified, the name of the current working directory on the local machine will be reported\&.
903.RE
904.PP
905link target linkname
906.RS 4
907This 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\&.
908.RE
909.PP
910listconnect
911.RS 4
912Show the current connections held for DFS purposes\&.
913.RE
914.PP
915lock <filenum> <r|w> <hex\-start> <hex\-len>
916.RS 4
917This 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\&.
918.RE
919.PP
920logon <username> <password>
921.RS 4
922Establishes 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\&.
923.RE
924.PP
925lowercase
926.RS 4
927Toggle lowercasing of filenames for the get and mget commands\&.
928.sp
929When 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\&.
930.RE
931.PP
932ls <mask>
933.RS 4
934See the dir command above\&.
935.RE
936.PP
937mask <mask>
938.RS 4
939This command allows the user to set up a mask which will be used during recursive operation of the mget and mput commands\&.
940.sp
941The masks specified to the mget and mput commands act as filters for directories rather than files when recursion is toggled ON\&.
942.sp
943The 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\&.
944.sp
945Note 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\&.
946.RE
947.PP
948md <directory name>
949.RS 4
950See the mkdir command\&.
951.RE
952.PP
953mget <mask>
954.RS 4
955Copy all files matching
956\fImask\fR
957from the server to the machine running the client\&.
958.sp
959Note that
960\fImask\fR
961is interpreted differently during recursive operation and non\-recursive operation \- refer to the recurse and mask commands for more information\&. Note that all transfers in
962\FCsmbclient\F[]
963are binary\&. See also the lowercase command\&.
964.RE
965.PP
966mkdir <directory name>
967.RS 4
968Create a new directory on the server (user access privileges permitting) with the specified name\&.
969.RE
970.PP
971more <file name>
972.RS 4
973Fetch a remote file and view it with the contents of your PAGER environment variable\&.
974.RE
975.PP
976mput <mask>
977.RS 4
978Copy all files matching
979\fImask\fR
980in the current working directory on the local machine to the current working directory on the server\&.
981.sp
982Note that
983\fImask\fR
984is interpreted differently during recursive operation and non\-recursive operation \- refer to the recurse and mask commands for more information\&. Note that all transfers in
985\FCsmbclient\F[]
986are binary\&.
987.RE
988.PP
989posix
990.RS 4
991Query 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),\&.
992.RE
993.PP
994posix_encrypt <domain> <username> <password>
995.RS 4
996This 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\&.
997.RE
998.PP
999posix_open <filename> <octal mode>
1000.RS 4
1001This 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\&.
1002.RE
1003.PP
1004posix_mkdir <directoryname> <octal mode>
1005.RS 4
1006This 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\&.
1007.RE
1008.PP
1009posix_rmdir <directoryname>
1010.RS 4
1011This 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\&.
1012.RE
1013.PP
1014posix_unlink <filename>
1015.RS 4
1016This 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\&.
1017.RE
1018.PP
1019print <file name>
1020.RS 4
1021Print the specified file from the local machine through a printable service on the server\&.
1022.RE
1023.PP
1024prompt
1025.RS 4
1026Toggle prompting for filenames during operation of the mget and mput commands\&.
1027.sp
1028When 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\&.
1029.RE
1030.PP
1031put <local file name> [remote file name]
1032.RS 4
1033Copy the file called
1034\FClocal file name\F[]
1035from the machine running the client to the server\&. If specified, name the remote copy
1036\FCremote file name\F[]\&. Note that all transfers in
1037\FCsmbclient\F[]
1038are binary\&. See also the lowercase command\&.
1039.RE
1040.PP
1041queue
1042.RS 4
1043Displays the print queue, showing the job id, name, size and current status\&.
1044.RE
1045.PP
1046quit
1047.RS 4
1048See the exit command\&.
1049.RE
1050.PP
1051readlink symlinkname
1052.RS 4
1053This command depends on the server supporting the CIFS UNIX extensions and will fail if the server does not\&. Print the value of the symlink "symlinkname"\&.
1054.RE
1055.PP
1056rd <directory name>
1057.RS 4
1058See the rmdir command\&.
1059.RE
1060.PP
1061recurse
1062.RS 4
1063Toggle directory recursion for the commands mget and mput\&.
1064.sp
1065When 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\&.
1066.sp
1067When 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\&.
1068.RE
1069.PP
1070rename <old filename> <new filename>
1071.RS 4
1072Rename files in the current working directory on the server from
1073\fIold filename\fR
1074to
1075\fInew filename\fR\&.
1076.RE
1077.PP
1078rm <mask>
1079.RS 4
1080Remove all files matching
1081\fImask\fR
1082from the current working directory on the server\&.
1083.RE
1084.PP
1085rmdir <directory name>
1086.RS 4
1087Remove the specified directory (user access privileges permitting) from the server\&.
1088.RE
1089.PP
1090setmode <filename> <perm=[+|\e\-]rsha>
1091.RS 4
1092A version of the DOS attrib command to set file permissions\&. For example:
1093.sp
1094\FCsetmode myfile +r \F[]
1095.sp
1096would make myfile read only\&.
1097.RE
1098.PP
1099showconnect
1100.RS 4
1101Show the currently active connection held for DFS purposes\&.
1102.RE
1103.PP
1104stat file
1105.RS 4
1106This 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\&.
1107.RE
1108.PP
1109symlink target linkname
1110.RS 4
1111This 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\&.
1112.RE
1113.PP
1114tar <c|x>[IXbgNa]
1115.RS 4
1116Performs a tar operation \- see the
1117\fI\-T \fR
1118command 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\&.
1119.RE
1120.PP
1121blocksize <blocksize>
1122.RS 4
1123Blocksize\&. Must be followed by a valid (greater than zero) blocksize\&. Causes tar file to be written out in
1124\fIblocksize\fR*TBLOCK (usually 512 byte) blocks\&.
1125.RE
1126.PP
1127tarmode <full|inc|reset|noreset>
1128.RS 4
1129Changes 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)\&.
1130.RE
1131.PP
1132unlock <filenum> <hex\-start> <hex\-len>
1133.RS 4
1134This 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\&.
1135.RE
1136.PP
1137volume
1138.RS 4
1139Prints the current volume name of the share\&.
1140.RE
1141.PP
1142vuid <number>
1143.RS 4
1144Changes 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\&.
1145.RE
1146.SH "NOTES"
1147.PP
1148Some 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\&.
1149.PP
1150It 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\&.
1151.PP
1152smbclient supports long file names where the server supports the LANMAN2 protocol or above\&.
1153.SH "ENVIRONMENT VARIABLES"
1154.PP
1155The variable
1156\fBUSER\fR
1157may 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\&.
1158.PP
1159The variable
1160\fBPASSWD\fR
1161may 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\&.
1162.PP
1163The variable
1164\fBLIBSMB_PROG\fR
1165may 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
1166.SH "INSTALLATION"
1167.PP
1168The location of the client program is a matter for individual system administrators\&. The following are thus suggestions only\&.
1169.PP
1170It is recommended that the smbclient software be installed in the
1171\FC/usr/local/samba/bin/\F[]
1172or
1173\FC /usr/samba/bin/\F[]
1174directory, this directory readable by all, writeable only by root\&. The client program itself should be executable by all\&. The client should
1175\fINOT\fR
1176be setuid or setgid!
1177.PP
1178The client log files should be put in a directory readable and writeable only by the user\&.
1179.PP
1180To test the client, you will need to know the name of a running SMB/CIFS server\&. It is possible to run
1181\fBsmbd\fR(8)
1182as 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\&.
1183.SH "DIAGNOSTICS"
1184.PP
1185Most 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\&.
1186.PP
1187The 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\&.
1188.SH "VERSION"
1189.PP
1190This man page is correct for version 3\&.2 of the Samba suite\&.
1191.SH "AUTHOR"
1192.PP
1193The 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\&.
1194.PP
1195The 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
1196ftp://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.