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

Last change on this file was 989, checked in by Silvan Scherrer, 9 years ago

Samba Server: update vendor to version 4.4.7

File size: 37.2 KB
Line 
1'\" t
2.\" Title: smbclient
3.\" Author: [see the "AUTHOR" section]
4.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
5.\" Date: 10/25/2016
6.\" Manual: User Commands
7.\" Source: Samba 4.4
8.\" Language: English
9.\"
10.TH "SMBCLIENT" "1" "10/25/2016" "Samba 4\&.4" "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>] [\-t\ <per\-operation\ timeout\ in\ seconds>] [\-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\ <per\-operation\ timeout\ in\ seconds>] [\-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 allows the user to select the highest SMB protocol level that smbclient will use to connect to the server\&. By default this is set to NT1, which is the highest available SMB1 protocol\&. To connect using SMB2 or SMB3 protocol, use the strings SMB2 or SMB3 respectively\&. Note that to connect to a Windows 2012 server with encrypted transport selecting a max\-protocol of SMB3 is required\&.
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\-I|\-\-ip\-address IP\-address
209.RS 4
210\fIIP address\fR
211is the address of the server to connect to\&. It should be specified in standard "a\&.b\&.c\&.d" notation\&.
212.sp
213Normally 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
214\fIname resolve order\fR
215parameter 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\&.
216.sp
217There is no default for this parameter\&. If not supplied, it will be determined automatically by the client as described above\&.
218.RE
219.PP
220\-E|\-\-stderr
221.RS 4
222This parameter causes the client to write messages to the standard error stream (stderr) rather than to the standard output stream\&.
223.sp
224By default, the client writes messages to standard output \- typically the user\*(Aqs tty\&.
225.RE
226.PP
227\-L|\-\-list
228.RS 4
229This option allows you to look at what services are available on a server\&. You use it as
230smbclient \-L host
231and a list should appear\&. The
232\fI\-I \fR
233option 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\&.
234.RE
235.PP
236\-b|\-\-send\-buffer buffersize
237.RS 4
238When sending or receiving files, smbclient uses an internal buffer sized by the maximum number of allowed requests to the connected server\&. This command allows this size to be set to any range between 0 (which means use the default server controlled size) bytes and 16776960 (0xFFFF00) bytes\&. Using the server controlled size is the most efficient as smbclient will pipeline as many simultaneous reads or writes needed to keep the server as busy as possible\&. Setting this to any other size will slow down the transfer\&. This can also be set using the
239iosize
240command inside smbclient\&.
241.RE
242.PP
243\-B|\-\-browse
244.RS 4
245Browse SMB servers using DNS\&.
246.RE
247.PP
248\-t|\-\-timeout <timeout\-seconds>
249.RS 4
250This allows the user to tune the default timeout used for each SMB request\&. The default setting is 20 seconds\&. Increase it if requests to the server sometimes time out\&. This can happen when SMB3 encryption is selected and smbclient is overwhelming the server with requests\&. This can also be set using the
251timeout
252command inside smbclient\&.
253.RE
254.PP
255\-T|\-\-tar tar options
256.RS 4
257smbclient may be used to create
258tar(1)
259compatible backups of all the files on an SMB/CIFS share\&. The secondary tar flags that can be given to this option are:
260.sp
261.RS 4
262.ie n \{\
263\h'-04'\(bu\h'+03'\c
264.\}
265.el \{\
266.sp -1
267.IP \(bu 2.3
268.\}
269\fIc\fR
270\- Create a tar backup archive on the local system\&. 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
271\fIx\fR
272flag\&.
273.RE
274.sp
275.RS 4
276.ie n \{\
277\h'-04'\(bu\h'+03'\c
278.\}
279.el \{\
280.sp -1
281.IP \(bu 2.3
282.\}
283\fIx\fR
284\- 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
285\fIc\fR
286flag\&. 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\&.
287.RE
288.sp
289.RS 4
290.ie n \{\
291\h'-04'\(bu\h'+03'\c
292.\}
293.el \{\
294.sp -1
295.IP \(bu 2.3
296.\}
297\fII\fR
298\- 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
299\fIr\fR
300below\&.
301.RE
302.sp
303.RS 4
304.ie n \{\
305\h'-04'\(bu\h'+03'\c
306.\}
307.el \{\
308.sp -1
309.IP \(bu 2.3
310.\}
311\fIX\fR
312\- 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\&. See
313\fIr\fR
314below\&.
315.RE
316.sp
317.RS 4
318.ie n \{\
319\h'-04'\(bu\h'+03'\c
320.\}
321.el \{\
322.sp -1
323.IP \(bu 2.3
324.\}
325\fIF\fR
326\- File containing a list of files and directories\&. The
327\fIF\fR
328causes 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
329\fIr\fR
330below\&.
331.RE
332.sp
333.RS 4
334.ie n \{\
335\h'-04'\(bu\h'+03'\c
336.\}
337.el \{\
338.sp -1
339.IP \(bu 2.3
340.\}
341\fIb\fR
342\- Blocksize\&. Must be followed by a valid (greater than zero) blocksize\&. Causes tar file to be written out in blocksize*TBLOCK (512 byte) blocks\&.
343.RE
344.sp
345.RS 4
346.ie n \{\
347\h'-04'\(bu\h'+03'\c
348.\}
349.el \{\
350.sp -1
351.IP \(bu 2.3
352.\}
353\fIg\fR
354\- Incremental\&. Only back up files that have the archive bit set\&. Useful only with the
355\fIc\fR
356flag\&.
357.RE
358.sp
359.RS 4
360.ie n \{\
361\h'-04'\(bu\h'+03'\c
362.\}
363.el \{\
364.sp -1
365.IP \(bu 2.3
366.\}
367\fIq\fR
368\- Quiet\&. Keeps tar from printing diagnostics as it works\&. This is the same as tarmode quiet\&.
369.RE
370.sp
371.RS 4
372.ie n \{\
373\h'-04'\(bu\h'+03'\c
374.\}
375.el \{\
376.sp -1
377.IP \(bu 2.3
378.\}
379\fIr\fR
380\- Use wildcard matching to include or exclude\&. Deprecated\&.
381.RE
382.sp
383.RS 4
384.ie n \{\
385\h'-04'\(bu\h'+03'\c
386.\}
387.el \{\
388.sp -1
389.IP \(bu 2.3
390.\}
391\fIN\fR
392\- 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
393\fIc\fR
394flag\&.
395.RE
396.sp
397.RS 4
398.ie n \{\
399\h'-04'\(bu\h'+03'\c
400.\}
401.el \{\
402.sp -1
403.IP \(bu 2.3
404.\}
405\fIa\fR
406\- Set archive bit\&. Causes the archive bit to be reset when a file is backed up\&. Useful with the
407\fIg\fR
408and
409\fIc\fR
410flags\&.
411.RE
412.sp
413.RE
414\fITar Long File Names\fR
415.sp
416smbclient\*(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,
417smbclient\*(Aqs tar option places all files in the archive with relative names, not absolute names\&.
418.sp
419\fITar Filenames\fR
420.sp
421All 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)\&.
422.sp
423\fIExamples\fR
424.sp
425Restore from tar file
426backup\&.tar
427into myshare on mypc (no password on share)\&.
428.sp
429smbclient //mypc/myshare "" \-N \-Tx backup\&.tar
430.sp
431Restore everything except
432users/docs
433.sp
434smbclient //mypc/myshare "" \-N \-TXx backup\&.tar users/docs
435.sp
436Create a tar file of the files beneath
437users/docs\&.
438.sp
439smbclient //mypc/myshare "" \-N \-Tc backup\&.tar users/docs
440.sp
441Create the same tar file as above, but now use a DOS path name\&.
442.sp
443smbclient //mypc/myshare "" \-N \-Tc backup\&.tar users\eedocs
444.sp
445Create a tar file of the files listed in the file
446tarlist\&.
447.sp
448smbclient //mypc/myshare "" \-N \-TcF backup\&.tar tarlist
449.sp
450Create a tar file of all the files and directories in the share\&.
451.sp
452smbclient //mypc/myshare "" \-N \-Tc backup\&.tar *
453.RE
454.PP
455\-D|\-\-directory initial directory
456.RS 4
457Change to initial directory before starting\&. Probably only of any use with the tar \-T option\&.
458.RE
459.PP
460\-c|\-\-command command string
461.RS 4
462command string is a semicolon\-separated list of commands to be executed instead of prompting from stdin\&.
463\fI \-N\fR
464is implied by
465\fI\-c\fR\&.
466.sp
467This is particularly useful in scripts and for printing stdin to the server, e\&.g\&.
468\-c \*(Aqprint \-\*(Aq\&.
469.RE
470.SH "OPERATIONS"
471.PP
472Once the client is running, the user is presented with a prompt :
473.PP
474smb:\e>
475.PP
476The backslash ("\e\e") indicates the current working directory on the server, and will change if the current working directory is changed\&.
477.PP
478The 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\&.
479.PP
480You can specify file names which have spaces in them by quoting the name with double quotes, for example "a long file name"\&.
481.PP
482Parameters 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\&.
483.PP
484Note 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\&.
485.PP
486The commands available are given here in alphabetical order\&.
487.PP
488? [command]
489.RS 4
490If
491\fIcommand\fR
492is 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\&.
493.RE
494.PP
495! [shell command]
496.RS 4
497If
498\fIshell command\fR
499is 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\&.
500.RE
501.PP
502allinfo file
503.RS 4
504The client will request that the server return all known information about a file or directory (including streams)\&.
505.RE
506.PP
507altname file
508.RS 4
509The client will request that the server return the "alternate" name (the 8\&.3 name) for a file or directory\&.
510.RE
511.PP
512archive <number>
513.RS 4
514Sets 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\&.
515.RE
516.PP
517backup
518.RS 4
519Toggle the state of the "backup intent" flag sent to the server on directory listings and file opens\&. If the "backup intent" flag is true, the server will try and bypass some file system checks if the user has been granted SE_BACKUP or SE_RESTORE privileges\&. This state is useful when performing a backup or restore operation\&.
520.RE
521.PP
522blocksize <number>
523.RS 4
524Sets 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\&.
525.RE
526.PP
527cancel jobid0 [jobid1] \&.\&.\&. [jobidN]
528.RS 4
529The client will request that the server cancel the printjobs identified by the given numeric print job ids\&.
530.RE
531.PP
532case_sensitive
533.RS 4
534Toggles 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\&.
535.RE
536.PP
537cd <directory name>
538.RS 4
539If "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\&.
540.sp
541If no directory name is specified, the current working directory on the server will be reported\&.
542.RE
543.PP
544chmod file mode in octal
545.RS 4
546This 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\&.
547.RE
548.PP
549chown file uid gid
550.RS 4
551This 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\&.
552.RE
553.PP
554close <fileid>
555.RS 4
556Closes a file explicitly opened by the open command\&. Used for internal Samba testing purposes\&.
557.RE
558.PP
559del <mask>
560.RS 4
561The client will request that the server attempt to delete all files matching
562\fImask\fR
563from the current working directory on the server\&.
564.RE
565.PP
566dir <mask>
567.RS 4
568A list of the files matching
569\fImask\fR
570in the current working directory on the server will be retrieved from the server and displayed\&.
571.RE
572.PP
573du <filename>
574.RS 4
575Does a directory listing and then prints out the current disk usage and free space on a share\&.
576.RE
577.PP
578echo <number> <data>
579.RS 4
580Does an SMBecho request to ping the server\&. Used for internal Samba testing purposes\&.
581.RE
582.PP
583exit
584.RS 4
585Terminate the connection with the server and exit from the program\&.
586.RE
587.PP
588get <remote file name> [local file name]
589.RS 4
590Copy the file called
591remote file name
592from the server to the machine running the client\&. If specified, name the local copy
593local file name\&. Note that all transfers in
594smbclient
595are binary\&. See also the lowercase command\&.
596.RE
597.PP
598getfacl <filename>
599.RS 4
600Requires the server support the UNIX extensions\&. Requests and prints the POSIX ACL on a file\&.
601.RE
602.PP
603hardlink <src> <dest>
604.RS 4
605Creates a hardlink on the server using Windows CIFS semantics\&.
606.RE
607.PP
608help [command]
609.RS 4
610See the ? command above\&.
611.RE
612.PP
613history
614.RS 4
615Displays the command history\&.
616.RE
617.PP
618iosize <bytes>
619.RS 4
620When sending or receiving files, smbclient uses an internal buffer sized by the maximum number of allowed requests to the connected server\&. This command allows this size to be set to any range between 0 (which means use the default server controlled size) bytes and 16776960 (0xFFFF00) bytes\&. Using the server controlled size is the most efficient as smbclient will pipeline as many simultaneous reads or writes needed to keep the server as busy as possible\&. Setting this to any other size will slow down the transfer\&.
621.RE
622.PP
623lcd [directory name]
624.RS 4
625If
626\fIdirectory name\fR
627is 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\&.
628.sp
629If no directory name is specified, the name of the current working directory on the local machine will be reported\&.
630.RE
631.PP
632link target linkname
633.RS 4
634This 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\&.
635.RE
636.PP
637listconnect
638.RS 4
639Show the current connections held for DFS purposes\&.
640.RE
641.PP
642lock <filenum> <r|w> <hex\-start> <hex\-len>
643.RS 4
644This 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\&.
645.RE
646.PP
647logon <username> <password>
648.RS 4
649Establishes 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\&.
650.RE
651.PP
652logoff
653.RS 4
654Logs the user off the server, closing the session\&. Used for internal Samba testing purposes\&.
655.RE
656.PP
657lowercase
658.RS 4
659Toggle lowercasing of filenames for the get and mget commands\&.
660.sp
661When 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\&.
662.RE
663.PP
664ls <mask>
665.RS 4
666See the dir command above\&.
667.RE
668.PP
669mask <mask>
670.RS 4
671This command allows the user to set up a mask which will be used during recursive operation of the mget and mput commands\&.
672.sp
673The masks specified to the mget and mput commands act as filters for directories rather than files when recursion is toggled ON\&.
674.sp
675The 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\&.
676.sp
677Note 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\&.
678.RE
679.PP
680md <directory name>
681.RS 4
682See the mkdir command\&.
683.RE
684.PP
685mget <mask>
686.RS 4
687Copy all files matching
688\fImask\fR
689from the server to the machine running the client\&.
690.sp
691Note that
692\fImask\fR
693is interpreted differently during recursive operation and non\-recursive operation \- refer to the recurse and mask commands for more information\&. Note that all transfers in
694smbclient
695are binary\&. See also the lowercase command\&.
696.RE
697.PP
698mkdir <directory name>
699.RS 4
700Create a new directory on the server (user access privileges permitting) with the specified name\&.
701.RE
702.PP
703more <file name>
704.RS 4
705Fetch a remote file and view it with the contents of your PAGER environment variable\&.
706.RE
707.PP
708mput <mask>
709.RS 4
710Copy all files matching
711\fImask\fR
712in the current working directory on the local machine to the current working directory on the server\&.
713.sp
714Note that
715\fImask\fR
716is interpreted differently during recursive operation and non\-recursive operation \- refer to the recurse and mask commands for more information\&. Note that all transfers in
717smbclient
718are binary\&.
719.RE
720.PP
721notify <dir name>
722.RS 4
723Query a directory for change notifications\&. This command issues a recursive filechangenotify call for all possible changes\&. As changes come in will print one line per change\&. See
724https://msdn\&.microsoft\&.com/en\-us/library/dn392331\&.aspx
725for a description of the action numbers that this command prints\&.
726.sp
727This command never ends, it waits for event indefinitely\&.
728.RE
729.PP
730posix
731.RS 4
732Query 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),\&.
733.RE
734.PP
735posix_encrypt <domain> <username> <password>
736.RS 4
737This 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\&.
738.RE
739.PP
740posix_open <filename> <octal mode>
741.RS 4
742This 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\&.
743.RE
744.PP
745posix_mkdir <directoryname> <octal mode>
746.RS 4
747This 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\&.
748.RE
749.PP
750posix_rmdir <directoryname>
751.RS 4
752This 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\&.
753.RE
754.PP
755posix_unlink <filename>
756.RS 4
757This 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\&.
758.RE
759.PP
760print <file name>
761.RS 4
762Print the specified file from the local machine through a printable service on the server\&.
763.RE
764.PP
765prompt
766.RS 4
767Toggle prompting for filenames during operation of the mget and mput commands\&.
768.sp
769When 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\&.
770.RE
771.PP
772put <local file name> [remote file name]
773.RS 4
774Copy the file called
775local file name
776from the machine running the client to the server\&. If specified, name the remote copy
777remote file name\&. Note that all transfers in
778smbclient
779are binary\&. See also the lowercase command\&.
780.RE
781.PP
782queue
783.RS 4
784Displays the print queue, showing the job id, name, size and current status\&.
785.RE
786.PP
787quit
788.RS 4
789See the exit command\&.
790.RE
791.PP
792readlink symlinkname
793.RS 4
794This 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"\&.
795.RE
796.PP
797rd <directory name>
798.RS 4
799See the rmdir command\&.
800.RE
801.PP
802recurse
803.RS 4
804Toggle directory recursion for the commands mget and mput\&.
805.sp
806When 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\&.
807.sp
808When 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\&.
809.RE
810.PP
811rename <old filename> <new filename>
812.RS 4
813Rename files in the current working directory on the server from
814\fIold filename\fR
815to
816\fInew filename\fR\&.
817.RE
818.PP
819rm <mask>
820.RS 4
821Remove all files matching
822\fImask\fR
823from the current working directory on the server\&.
824.RE
825.PP
826rmdir <directory name>
827.RS 4
828Remove the specified directory (user access privileges permitting) from the server\&.
829.RE
830.PP
831scopy <source filename> <destination filename>
832.RS 4
833Attempt to copy a file on the server using the most efficient server\-side copy calls\&. Falls back to using read then write if server doesn\*(Aqt support server\-side copy\&.
834.RE
835.PP
836setmode <filename> <perm=[+|\e\-]rsha>
837.RS 4
838A version of the DOS attrib command to set file permissions\&. For example:
839.sp
840setmode myfile +r
841.sp
842would make myfile read only\&.
843.RE
844.PP
845showconnect
846.RS 4
847Show the currently active connection held for DFS purposes\&.
848.RE
849.PP
850stat file
851.RS 4
852This 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\&.
853.RE
854.PP
855symlink target linkname
856.RS 4
857This 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\&.
858.RE
859.PP
860tar <c|x>[IXbgNa]
861.RS 4
862Performs a tar operation \- see the
863\fI\-T\fR
864command 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\&.
865.RE
866.PP
867blocksize <blocksize>
868.RS 4
869Blocksize\&. Must be followed by a valid (greater than zero) blocksize\&. Causes tar file to be written out in
870\fIblocksize\fR*TBLOCK (512 byte) blocks\&.
871.RE
872.PP
873tarmode <full|inc|reset|noreset|system|nosystem|hidden|nohidden>
874.RS 4
875Changes tar\*(Aqs behavior with regard to DOS attributes\&. There are 4 modes which can be turned on or off\&.
876.sp
877Incremental mode (default off)\&. When off (using
878full) tar will back up everything regardless of the
879\fIarchive\fR
880bit setting\&. When on (using
881inc), tar will only back up files with the archive bit set\&.
882.sp
883Reset mode (default off)\&. When on (using
884reset), tar will remove the archive bit on all files it backs up (implies read/write share)\&. Use
885noreset
886to turn off\&.
887.sp
888System mode (default on)\&. When off, tar will not backup system files\&. Use
889nosystem
890to turn off\&.
891.sp
892Hidden mode (default on)\&. When off, tar will not backup hidden files\&. Use
893nohidden
894to turn off\&.
895.RE
896.PP
897timeout <per\-operation timeout in seconds>
898.RS 4
899This allows the user to tune the default timeout used for each SMB request\&. The default setting is 20 seconds\&. Increase it if requests to the server sometimes time out\&. This can happen when SMB3 encryption is selected and smbclient is overwhelming the server with requests\&.
900.RE
901.PP
902unlock <filenum> <hex\-start> <hex\-len>
903.RS 4
904This 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\&.
905.RE
906.PP
907volume
908.RS 4
909Prints the current volume name of the share\&.
910.RE
911.PP
912vuid <number>
913.RS 4
914Changes 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\&.
915.RE
916.PP
917tcon <sharename>
918.RS 4
919Establishes a new tree connect (connection to a share)\&. Replaces the current tree connect\&. Prints the new tid (tree id)\&. Used for internal Samba testing purposes\&.
920.RE
921.PP
922tdis
923.RS 4
924Close the current share connection (tree disconnect)\&. Used for internal Samba testing purposes\&.
925.RE
926.PP
927tid <number>
928.RS 4
929Changes the current tree id (tid) in the protocol to a new arbitrary number\&. Without an argument, it prints out the tid currently used\&. Used for internal Samba testing purposes\&.
930.RE
931.SH "NOTES"
932.PP
933Some 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\&.
934.PP
935It 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\&.
936.PP
937smbclient supports long file names where the server supports the LANMAN2 protocol or above\&.
938.SH "ENVIRONMENT VARIABLES"
939.PP
940The variable
941\fBUSER\fR
942may 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\&.
943.PP
944The variable
945\fBPASSWD\fR
946may 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\&.
947.PP
948The variable
949\fBLIBSMB_PROG\fR
950may 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
951.SH "INSTALLATION"
952.PP
953The location of the client program is a matter for individual system administrators\&. The following are thus suggestions only\&.
954.PP
955It is recommended that the smbclient software be installed in the
956/usr/local/samba/bin/
957or
958/usr/samba/bin/
959directory, this directory readable by all, writeable only by root\&. The client program itself should be executable by all\&. The client should
960\fINOT\fR
961be setuid or setgid!
962.PP
963The client log files should be put in a directory readable and writeable only by the user\&.
964.PP
965To test the client, you will need to know the name of a running SMB/CIFS server\&. It is possible to run
966\fBsmbd\fR(8)
967as 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\&.
968.SH "DIAGNOSTICS"
969.PP
970Most 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\&.
971.PP
972The 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\&.
973.SH "VERSION"
974.PP
975This man page is correct for version 3\&.2 of the Samba suite\&.
976.SH "AUTHOR"
977.PP
978The 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\&.
979.PP
980The 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
981ftp://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.