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

Last change on this file was 860, checked in by Silvan Scherrer, 11 years ago

Samba 3.6: updated vendor to latest version

File size: 39.1 KB
Line 
1'\" t
2.\" Title: smbclient
3.\" Author: [see the "AUTHOR" section]
4.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
5.\" Date: 09/18/2013
6.\" Manual: User Commands
7.\" Source: Samba 3.6
8.\" Language: English
9.\"
10.TH "SMBCLIENT" "1" "09/18/2013" "Samba 3\&.6" "User Commands"
11.\" -----------------------------------------------------------------
12.\" * Define some portability stuff
13.\" -----------------------------------------------------------------
14.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15.\" http://bugs.debian.org/507673
16.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18.ie \n(.g .ds Aq \(aq
19.el .ds Aq '
20.\" -----------------------------------------------------------------
21.\" * set default formatting
22.\" -----------------------------------------------------------------
23.\" disable hyphenation
24.nh
25.\" disable justification (adjust text to left margin only)
26.ad l
27.\" -----------------------------------------------------------------
28.\" * MAIN CONTENT STARTS HERE *
29.\" -----------------------------------------------------------------
30.SH "NAME"
31smbclient \- ftp\-like client to access SMB/CIFS resources on servers
32.SH "SYNOPSIS"
33.HP \w'\ 'u
34smbclient [\-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>]
35.HP \w'\ 'u
36smbclient {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]
37.SH "DESCRIPTION"
38.PP
39This tool is part of the
40\fBsamba\fR(7)
41suite\&.
42.PP
43smbclient
44is a client that can \*(Aqtalk\*(Aq to an SMB/CIFS server\&. It offers an interface similar to that of the ftp program (see
45\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\&.
46.SH "OPTIONS"
47.PP
48servicename
49.RS 4
50servicename is the name of the service you want to use on the server\&. A service name takes the form
51//server/service
52where
53\fIserver \fR
54is the NetBIOS name of the SMB/CIFS server offering the desired service and
55\fIservice\fR
56is the name of the service offered\&. Thus to connect to the service "printer" on the SMB/CIFS server "smbserver", you would use the servicename
57//smbserver/printer
58.sp
59Note 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\&.
60.sp
61The server name is looked up according to either the
62\fI\-R\fR
63parameter to
64smbclient
65or using the name resolve order parameter in the
66\fBsmb.conf\fR(5)
67file, allowing an administrator to change the order and methods by which server names are looked up\&.
68.RE
69.PP
70password
71.RS 4
72The password required to access the specified service on the specified server\&. If this parameter is supplied, the
73\fI\-N\fR
74option (suppress password prompt) is assumed\&.
75.sp
76There is no default password\&. If no password is supplied on the command line (either by using this parameter or adding a password to the
77\fI\-U\fR
78option (see below)) and the
79\fI\-N\fR
80option 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\&.)
81.sp
82Note: 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\&.
83.sp
84Be cautious about including passwords in scripts\&.
85.RE
86.PP
87\-R|\-\-name\-resolve <name resolve order>
88.RS 4
89This 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\&.
90.sp
91The options are :"lmhosts", "host", "wins" and "bcast"\&. They cause names to be resolved as follows:
92.sp
93.RS 4
94.ie n \{\
95\h'-04'\(bu\h'+03'\c
96.\}
97.el \{\
98.sp -1
99.IP \(bu 2.3
100.\}
101\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
102\fBlmhosts\fR(5)
103for details) then any name type matches for lookup\&.
104.RE
105.sp
106.RS 4
107.ie n \{\
108\h'-04'\(bu\h'+03'\c
109.\}
110.el \{\
111.sp -1
112.IP \(bu 2.3
113.\}
114\fBhost\fR: Do a standard host name to IP address resolution, using the system
115/etc/hosts, 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
116/etc/nsswitch\&.conf
117file)\&. Note that this method is only used if the NetBIOS name type being queried is the 0x20 (server) name type, otherwise it is ignored\&.
118.RE
119.sp
120.RS 4
121.ie n \{\
122\h'-04'\(bu\h'+03'\c
123.\}
124.el \{\
125.sp -1
126.IP \(bu 2.3
127.\}
128\fBwins\fR: Query a name with the IP address listed in the
129\fIwins server\fR
130parameter\&. If no WINS server has been specified this method will be ignored\&.
131.RE
132.sp
133.RS 4
134.ie n \{\
135\h'-04'\(bu\h'+03'\c
136.\}
137.el \{\
138.sp -1
139.IP \(bu 2.3
140.\}
141\fBbcast\fR: Do a broadcast on each of the known local interfaces listed in the
142\fIinterfaces\fR
143parameter\&. This is the least reliable of the name resolution methods as it depends on the target host being on a locally connected subnet\&.
144.RE
145.sp
146.RE
147If this parameter is not set then the name resolve order defined in the
148\fBsmb.conf\fR(5)
149file parameter (name resolve order) will be used\&.
150.sp
151The default order is lmhosts, host, wins, bcast and without this parameter or any entry in the
152\fIname resolve order \fR
153parameter of the
154\fBsmb.conf\fR(5)
155file the name resolution methods will be attempted in this order\&.
156.RE
157.PP
158\-M|\-\-message NetBIOS name
159.RS 4
160This 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\&.
161.sp
162If 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\&.
163.sp
164The message is also automatically truncated if the message is over 1600 bytes, as this is the limit of the protocol\&.
165.sp
166One useful trick is to pipe the message through
167smbclient\&. For example: smbclient \-M FRED < mymessage\&.txt will send the message in the file
168mymessage\&.txt
169to the machine FRED\&.
170.sp
171You may also find the
172\fI\-U\fR
173and
174\fI\-I\fR
175options useful, as they allow you to control the FROM and TO parts of the message\&.
176.sp
177See the
178\fImessage command\fR
179parameter in the
180\fBsmb.conf\fR(5)
181for a description of how to handle incoming WinPopup messages in Samba\&.
182.sp
183\fINote\fR: Copy WinPopup into the startup group on your WfWg PCs if you want them to always be able to receive messages\&.
184.RE
185.PP
186\-p|\-\-port port
187.RS 4
188This 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\&.
189.RE
190.PP
191\-g|\-\-grepable
192.RS 4
193This parameter provides combined with
194\fI\-L\fR
195easy parseable output that allows processing with utilities such as grep and cut\&.
196.RE
197.PP
198\-m|\-\-max\-protocol protocol
199.RS 4
200This parameter sets the maximum protocol version announced by the client\&.
201.RE
202.PP
203\-P|\-\-machine\-pass
204.RS 4
205Make queries to the external server using the machine account of the local server\&.
206.RE
207.PP
208\-h|\-\-help
209.RS 4
210Print a summary of command line options\&.
211.RE
212.PP
213\-I|\-\-ip\-address IP\-address
214.RS 4
215\fIIP address\fR
216is the address of the server to connect to\&. It should be specified in standard "a\&.b\&.c\&.d" notation\&.
217.sp
218Normally 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
219\fIname resolve order\fR
220parameter 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\&.
221.sp
222There is no default for this parameter\&. If not supplied, it will be determined automatically by the client as described above\&.
223.RE
224.PP
225\-E|\-\-stderr
226.RS 4
227This parameter causes the client to write messages to the standard error stream (stderr) rather than to the standard output stream\&.
228.sp
229By default, the client writes messages to standard output \- typically the user\*(Aqs tty\&.
230.RE
231.PP
232\-L|\-\-list
233.RS 4
234This option allows you to look at what services are available on a server\&. You use it as
235smbclient \-L host
236and a list should appear\&. The
237\fI\-I \fR
238option may be useful if your NetBIOS names don\*(Aqt match your TCP/IP DNS host names or if you are trying to reach a host on another network\&.
239.RE
240.PP
241\-b|\-\-send\-buffer buffersize
242.RS 4
243This 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\&.
244.RE
245.PP
246\-e|\-\-encrypt
247.RS 4
248This 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 negotiation (either kerberos or NTLMv1/v2 if given domain/username/password triple\&. Fails the connection if encryption cannot be negotiated\&.
249.RE
250.PP
251\-d|\-\-debuglevel=level
252.RS 4
253\fIlevel\fR
254is an integer from 0 to 10\&. The default value if this parameter is not specified is 1\&.
255.sp
256The 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\&.
257.sp
258Levels 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\&.
259.sp
260Note that specifying this parameter here will override the
261\m[blue]\fBlog level\fR\m[]
262parameter in the
263smb\&.conf
264file\&.
265.RE
266.PP
267\-V|\-\-version
268.RS 4
269Prints the program version number\&.
270.RE
271.PP
272\-s|\-\-configfile <configuration file>
273.RS 4
274The 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
275smb\&.conf
276for more information\&. The default configuration file name is determined at compile time\&.
277.RE
278.PP
279\-l|\-\-log\-basename=logdirectory
280.RS 4
281Base directory name for log/debug files\&. The extension
282\fB"\&.progname"\fR
283will be appended (e\&.g\&. log\&.smbclient, log\&.smbd, etc\&.\&.\&.)\&. The log file is never removed by the client\&.
284.RE
285.PP
286\-N|\-\-no\-pass
287.RS 4
288If 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\&.
289.sp
290Unless a password is specified on the command line or this parameter is specified, the client will request a password\&.
291.sp
292If 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\&.
293.RE
294.PP
295\-k|\-\-kerberos
296.RS 4
297Try to authenticate with kerberos\&. Only useful in an Active Directory environment\&.
298.RE
299.PP
300\-C|\-\-use\-ccache
301.RS 4
302Try to use the credentials cached by winbind\&.
303.RE
304.PP
305\-A|\-\-authentication\-file=filename
306.RS 4
307This 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
308.sp
309.if n \{\
310.RS 4
311.\}
312.nf
313username = <value>
314password = <value>
315domain = <value>
316.fi
317.if n \{\
318.RE
319.\}
320.sp
321Make certain that the permissions on the file restrict access from unwanted users\&.
322.RE
323.PP
324\-U|\-\-user=username[%password]
325.RS 4
326Sets the SMB username or username and password\&.
327.sp
328If %password is not specified, the user will be prompted\&. The client will first check the
329\fBUSER\fR
330environment variable, then the
331\fBLOGNAME\fR
332variable and if either exists, the string is uppercased\&. If these environmental variables are not found, the username
333\fBGUEST\fR
334is used\&.
335.sp
336A 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
337\fI\-A\fR
338for more details\&.
339.sp
340Be cautious about including passwords in scripts\&. Also, on many systems the command line of a running process may be seen via the
341ps
342command\&. To be safe always allow
343rpcclient
344to prompt for a password and type it in directly\&.
345.RE
346.PP
347\-n|\-\-netbiosname <primary NetBIOS name>
348.RS 4
349This option allows you to override the NetBIOS name that Samba uses for itself\&. This is identical to setting the
350\m[blue]\fBnetbios name\fR\m[]
351parameter in the
352smb\&.conf
353file\&. However, a command line setting will take precedence over settings in
354smb\&.conf\&.
355.RE
356.PP
357\-i|\-\-scope <scope>
358.RS 4
359This specifies a NetBIOS scope that
360nmblookup
361will 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
362\fIvery\fR
363rarely used, only set this parameter if you are the system administrator in charge of all the NetBIOS systems you communicate with\&.
364.RE
365.PP
366\-W|\-\-workgroup=domain
367.RS 4
368Set 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)\&.
369.RE
370.PP
371\-O|\-\-socket\-options socket options
372.RS 4
373TCP socket options to set on the client socket\&. See the socket options parameter in the
374smb\&.conf
375manual page for the list of valid options\&.
376.RE
377.PP
378\-T|\-\-tar tar options
379.RS 4
380smbclient may be used to create
381tar(1)
382compatible backups of all the files on an SMB/CIFS share\&. The secondary tar flags that can be given to this option are :
383.sp
384.RS 4
385.ie n \{\
386\h'-04'\(bu\h'+03'\c
387.\}
388.el \{\
389.sp -1
390.IP \(bu 2.3
391.\}
392\fIc\fR
393\- 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
394\fIx\fR
395flag\&.
396.RE
397.sp
398.RS 4
399.ie n \{\
400\h'-04'\(bu\h'+03'\c
401.\}
402.el \{\
403.sp -1
404.IP \(bu 2.3
405.\}
406\fIx\fR
407\- 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
408\fIc\fR
409flag\&. 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\&.
410.RE
411.sp
412.RS 4
413.ie n \{\
414\h'-04'\(bu\h'+03'\c
415.\}
416.el \{\
417.sp -1
418.IP \(bu 2.3
419.\}
420\fII\fR
421\- 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
422\fIr\fR
423below\&.
424.RE
425.sp
426.RS 4
427.ie n \{\
428\h'-04'\(bu\h'+03'\c
429.\}
430.el \{\
431.sp -1
432.IP \(bu 2.3
433.\}
434\fIX\fR
435\- 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
436\fIr\fR
437below\&.
438.RE
439.sp
440.RS 4
441.ie n \{\
442\h'-04'\(bu\h'+03'\c
443.\}
444.el \{\
445.sp -1
446.IP \(bu 2.3
447.\}
448\fIF\fR
449\- File containing a list of files and directories\&. The
450\fIF\fR
451causes 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
452\fIr\fR
453below\&.
454.RE
455.sp
456.RS 4
457.ie n \{\
458\h'-04'\(bu\h'+03'\c
459.\}
460.el \{\
461.sp -1
462.IP \(bu 2.3
463.\}
464\fIb\fR
465\- 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\&.
466.RE
467.sp
468.RS 4
469.ie n \{\
470\h'-04'\(bu\h'+03'\c
471.\}
472.el \{\
473.sp -1
474.IP \(bu 2.3
475.\}
476\fIg\fR
477\- Incremental\&. Only back up files that have the archive bit set\&. Useful only with the
478\fIc\fR
479flag\&.
480.RE
481.sp
482.RS 4
483.ie n \{\
484\h'-04'\(bu\h'+03'\c
485.\}
486.el \{\
487.sp -1
488.IP \(bu 2.3
489.\}
490\fIq\fR
491\- Quiet\&. Keeps tar from printing diagnostics as it works\&. This is the same as tarmode quiet\&.
492.RE
493.sp
494.RS 4
495.ie n \{\
496\h'-04'\(bu\h'+03'\c
497.\}
498.el \{\
499.sp -1
500.IP \(bu 2.3
501.\}
502\fIr\fR
503\- 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 \*(Aq*\*(Aq and \*(Aq?\*(Aq\&.
504.RE
505.sp
506.RS 4
507.ie n \{\
508\h'-04'\(bu\h'+03'\c
509.\}
510.el \{\
511.sp -1
512.IP \(bu 2.3
513.\}
514\fIN\fR
515\- 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
516\fIc\fR
517flag\&.
518.RE
519.sp
520.RS 4
521.ie n \{\
522\h'-04'\(bu\h'+03'\c
523.\}
524.el \{\
525.sp -1
526.IP \(bu 2.3
527.\}
528\fIa\fR
529\- Set archive bit\&. Causes the archive bit to be reset when a file is backed up\&. Useful with the
530\fIg\fR
531and
532\fIc\fR
533flags\&.
534.RE
535.sp
536.RE
537\fITar Long File Names\fR
538.sp
539smbclient\*(Aqs 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,
540smbclient\*(Aqs tar option places all files in the archive with relative names, not absolute names\&.
541.sp
542\fITar Filenames\fR
543.sp
544All file names can be given as DOS path names (with \*(Aq\e\e\*(Aq as the component separator) or as UNIX path names (with \*(Aq/\*(Aq as the component separator)\&.
545.sp
546\fIExamples\fR
547.sp
548Restore from tar file
549backup\&.tar
550into myshare on mypc (no password on share)\&.
551.sp
552smbclient //mypc/myshare "" \-N \-Tx backup\&.tar
553.sp
554Restore everything except
555users/docs
556.sp
557smbclient //mypc/myshare "" \-N \-TXx backup\&.tar users/docs
558.sp
559Create a tar file of the files beneath
560users/docs\&.
561.sp
562smbclient //mypc/myshare "" \-N \-Tc backup\&.tar users/docs
563.sp
564Create the same tar file as above, but now use a DOS path name\&.
565.sp
566smbclient //mypc/myshare "" \-N \-tc backup\&.tar users\eedocs
567.sp
568Create a tar file of the files listed in the file
569tarlist\&.
570.sp
571smbclient //mypc/myshare "" \-N \-TcF backup\&.tar tarlist
572.sp
573Create a tar file of all the files and directories in the share\&.
574.sp
575smbclient //mypc/myshare "" \-N \-Tc backup\&.tar *
576.RE
577.PP
578\-D|\-\-directory initial directory
579.RS 4
580Change to initial directory before starting\&. Probably only of any use with the tar \-T option\&.
581.RE
582.PP
583\-c|\-\-command command string
584.RS 4
585command string is a semicolon\-separated list of commands to be executed instead of prompting from stdin\&.
586\fI \-N\fR
587is implied by
588\fI\-c\fR\&.
589.sp
590This is particularly useful in scripts and for printing stdin to the server, e\&.g\&.
591\-c \*(Aqprint \-\*(Aq\&.
592.RE
593.SH "OPERATIONS"
594.PP
595Once the client is running, the user is presented with a prompt :
596.PP
597smb:\e>
598.PP
599The backslash ("\e\e") indicates the current working directory on the server, and will change if the current working directory is changed\&.
600.PP
601The 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\&.
602.PP
603You can specify file names which have spaces in them by quoting the name with double quotes, for example "a long file name"\&.
604.PP
605Parameters 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\&.
606.PP
607Note 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\&.
608.PP
609The commands available are given here in alphabetical order\&.
610.PP
611? [command]
612.RS 4
613If
614\fIcommand\fR
615is 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\&.
616.RE
617.PP
618! [shell command]
619.RS 4
620If
621\fIshell command\fR
622is 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\&.
623.RE
624.PP
625allinfo file
626.RS 4
627The client will request that the server return all known information about a file or directory (including streams)\&.
628.RE
629.PP
630altname file
631.RS 4
632The client will request that the server return the "alternate" name (the 8\&.3 name) for a file or directory\&.
633.RE
634.PP
635archive <number>
636.RS 4
637Sets 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\&.
638.RE
639.PP
640blocksize <number>
641.RS 4
642Sets 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\&.
643.RE
644.PP
645cancel jobid0 [jobid1] \&.\&.\&. [jobidN]
646.RS 4
647The client will request that the server cancel the printjobs identified by the given numeric print job ids\&.
648.RE
649.PP
650case_sensitive
651.RS 4
652Toggles 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\&.
653.RE
654.PP
655cd <directory name>
656.RS 4
657If "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\&.
658.sp
659If no directory name is specified, the current working directory on the server will be reported\&.
660.RE
661.PP
662chmod file mode in octal
663.RS 4
664This 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\&.
665.RE
666.PP
667chown file uid gid
668.RS 4
669This 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\&.
670.RE
671.PP
672close <fileid>
673.RS 4
674Closes a file explicitly opened by the open command\&. Used for internal Samba testing purposes\&.
675.RE
676.PP
677del <mask>
678.RS 4
679The client will request that the server attempt to delete all files matching
680\fImask\fR
681from the current working directory on the server\&.
682.RE
683.PP
684dir <mask>
685.RS 4
686A list of the files matching
687\fImask\fR
688in the current working directory on the server will be retrieved from the server and displayed\&.
689.RE
690.PP
691du <filename>
692.RS 4
693Does a directory listing and then prints out the current disk usage and free space on a share\&.
694.RE
695.PP
696echo <number> <data>
697.RS 4
698Does an SMBecho request to ping the server\&. Used for internal Samba testing purposes\&.
699.RE
700.PP
701exit
702.RS 4
703Terminate the connection with the server and exit from the program\&.
704.RE
705.PP
706get <remote file name> [local file name]
707.RS 4
708Copy the file called
709remote file name
710from the server to the machine running the client\&. If specified, name the local copy
711local file name\&. Note that all transfers in
712smbclient
713are binary\&. See also the lowercase command\&.
714.RE
715.PP
716getfacl <filename>
717.RS 4
718Requires the server support the UNIX extensions\&. Requests and prints the POSIX ACL on a file\&.
719.RE
720.PP
721hardlink <src> <dest>
722.RS 4
723Creates a hardlink on the server using Windows CIFS semantics\&.
724.RE
725.PP
726help [command]
727.RS 4
728See the ? command above\&.
729.RE
730.PP
731history
732.RS 4
733Displays the command history\&.
734.RE
735.PP
736iosize <bytes>
737.RS 4
738When 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\&.
739.RE
740.PP
741lcd [directory name]
742.RS 4
743If
744\fIdirectory name\fR
745is 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\&.
746.sp
747If no directory name is specified, the name of the current working directory on the local machine will be reported\&.
748.RE
749.PP
750link target linkname
751.RS 4
752This 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\&.
753.RE
754.PP
755listconnect
756.RS 4
757Show the current connections held for DFS purposes\&.
758.RE
759.PP
760lock <filenum> <r|w> <hex\-start> <hex\-len>
761.RS 4
762This 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\&.
763.RE
764.PP
765logon <username> <password>
766.RS 4
767Establishes 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\&.
768.RE
769.PP
770lowercase
771.RS 4
772Toggle lowercasing of filenames for the get and mget commands\&.
773.sp
774When 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\&.
775.RE
776.PP
777ls <mask>
778.RS 4
779See the dir command above\&.
780.RE
781.PP
782mask <mask>
783.RS 4
784This command allows the user to set up a mask which will be used during recursive operation of the mget and mput commands\&.
785.sp
786The masks specified to the mget and mput commands act as filters for directories rather than files when recursion is toggled ON\&.
787.sp
788The 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\&.
789.sp
790Note 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\&.
791.RE
792.PP
793md <directory name>
794.RS 4
795See the mkdir command\&.
796.RE
797.PP
798mget <mask>
799.RS 4
800Copy all files matching
801\fImask\fR
802from the server to the machine running the client\&.
803.sp
804Note that
805\fImask\fR
806is interpreted differently during recursive operation and non\-recursive operation \- refer to the recurse and mask commands for more information\&. Note that all transfers in
807smbclient
808are binary\&. See also the lowercase command\&.
809.RE
810.PP
811mkdir <directory name>
812.RS 4
813Create a new directory on the server (user access privileges permitting) with the specified name\&.
814.RE
815.PP
816more <file name>
817.RS 4
818Fetch a remote file and view it with the contents of your PAGER environment variable\&.
819.RE
820.PP
821mput <mask>
822.RS 4
823Copy all files matching
824\fImask\fR
825in the current working directory on the local machine to the current working directory on the server\&.
826.sp
827Note that
828\fImask\fR
829is interpreted differently during recursive operation and non\-recursive operation \- refer to the recurse and mask commands for more information\&. Note that all transfers in
830smbclient
831are binary\&.
832.RE
833.PP
834posix
835.RS 4
836Query 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),\&.
837.RE
838.PP
839posix_encrypt <domain> <username> <password>
840.RS 4
841This 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\&.
842.RE
843.PP
844posix_open <filename> <octal mode>
845.RS 4
846This 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\&.
847.RE
848.PP
849posix_mkdir <directoryname> <octal mode>
850.RS 4
851This 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\&.
852.RE
853.PP
854posix_rmdir <directoryname>
855.RS 4
856This 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\&.
857.RE
858.PP
859posix_unlink <filename>
860.RS 4
861This 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\&.
862.RE
863.PP
864print <file name>
865.RS 4
866Print the specified file from the local machine through a printable service on the server\&.
867.RE
868.PP
869prompt
870.RS 4
871Toggle prompting for filenames during operation of the mget and mput commands\&.
872.sp
873When 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\&.
874.RE
875.PP
876put <local file name> [remote file name]
877.RS 4
878Copy the file called
879local file name
880from the machine running the client to the server\&. If specified, name the remote copy
881remote file name\&. Note that all transfers in
882smbclient
883are binary\&. See also the lowercase command\&.
884.RE
885.PP
886queue
887.RS 4
888Displays the print queue, showing the job id, name, size and current status\&.
889.RE
890.PP
891quit
892.RS 4
893See the exit command\&.
894.RE
895.PP
896readlink symlinkname
897.RS 4
898This 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"\&.
899.RE
900.PP
901rd <directory name>
902.RS 4
903See the rmdir command\&.
904.RE
905.PP
906recurse
907.RS 4
908Toggle directory recursion for the commands mget and mput\&.
909.sp
910When 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\&.
911.sp
912When 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\&.
913.RE
914.PP
915rename <old filename> <new filename>
916.RS 4
917Rename files in the current working directory on the server from
918\fIold filename\fR
919to
920\fInew filename\fR\&.
921.RE
922.PP
923rm <mask>
924.RS 4
925Remove all files matching
926\fImask\fR
927from the current working directory on the server\&.
928.RE
929.PP
930rmdir <directory name>
931.RS 4
932Remove the specified directory (user access privileges permitting) from the server\&.
933.RE
934.PP
935setmode <filename> <perm=[+|\e\-]rsha>
936.RS 4
937A version of the DOS attrib command to set file permissions\&. For example:
938.sp
939setmode myfile +r
940.sp
941would make myfile read only\&.
942.RE
943.PP
944showconnect
945.RS 4
946Show the currently active connection held for DFS purposes\&.
947.RE
948.PP
949stat file
950.RS 4
951This 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\&.
952.RE
953.PP
954symlink target linkname
955.RS 4
956This 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\&.
957.RE
958.PP
959tar <c|x>[IXbgNa]
960.RS 4
961Performs a tar operation \- see the
962\fI\-T \fR
963command 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\&.
964.RE
965.PP
966blocksize <blocksize>
967.RS 4
968Blocksize\&. Must be followed by a valid (greater than zero) blocksize\&. Causes tar file to be written out in
969\fIblocksize\fR*TBLOCK (usually 512 byte) blocks\&.
970.RE
971.PP
972tarmode <full|inc|reset|noreset>
973.RS 4
974Changes tar\*(Aqs 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)\&.
975.RE
976.PP
977unlock <filenum> <hex\-start> <hex\-len>
978.RS 4
979This 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\&.
980.RE
981.PP
982volume
983.RS 4
984Prints the current volume name of the share\&.
985.RE
986.PP
987vuid <number>
988.RS 4
989Changes 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\&.
990.RE
991.SH "NOTES"
992.PP
993Some 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\&.
994.PP
995It 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\&.
996.PP
997smbclient supports long file names where the server supports the LANMAN2 protocol or above\&.
998.SH "ENVIRONMENT VARIABLES"
999.PP
1000The variable
1001\fBUSER\fR
1002may 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\&.
1003.PP
1004The variable
1005\fBPASSWD\fR
1006may 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\&.
1007.PP
1008The variable
1009\fBLIBSMB_PROG\fR
1010may 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
1011.SH "INSTALLATION"
1012.PP
1013The location of the client program is a matter for individual system administrators\&. The following are thus suggestions only\&.
1014.PP
1015It is recommended that the smbclient software be installed in the
1016/usr/local/samba/bin/
1017or
1018/usr/samba/bin/
1019directory, this directory readable by all, writeable only by root\&. The client program itself should be executable by all\&. The client should
1020\fINOT\fR
1021be setuid or setgid!
1022.PP
1023The client log files should be put in a directory readable and writeable only by the user\&.
1024.PP
1025To test the client, you will need to know the name of a running SMB/CIFS server\&. It is possible to run
1026\fBsmbd\fR(8)
1027as 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\&.
1028.SH "DIAGNOSTICS"
1029.PP
1030Most 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\&.
1031.PP
1032The 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\&.
1033.SH "VERSION"
1034.PP
1035This man page is correct for version 3\&.2 of the Samba suite\&.
1036.SH "AUTHOR"
1037.PP
1038The 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\&.
1039.PP
1040The 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
1041ftp://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.