source: branches/samba-3.5.x/docs/manpages/smbclient.1@ 732

Last change on this file since 732 was 732, checked in by Silvan Scherrer, 13 years ago

Samba Server 3.5: update branche to 3.5.12

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