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

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

Update Samba 3.3 to 3.3.10 (docs)

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