source: trunk/server/docs/manpages/smbclient.1@ 596

Last change on this file since 596 was 596, checked in by Herwig Bauernfeind, 14 years ago

Samba 3.5: Update trunk to 3.5.8

File size: 39.6 KB
RevLine 
[596]1'\" t
[429]2.\" Title: smbclient
3.\" Author: [see the "AUTHOR" section]
[596]4.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
5.\" Date: 03/06/2011
[429]6.\" Manual: User Commands
7.\" Source: Samba 3.5
8.\" Language: English
9.\"
[596]10.TH "SMBCLIENT" "1" "03/06/2011" "Samba 3\&.5" "User Commands"
[429]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.\" -----------------------------------------------------------------
[596]21.SH "NAME"
[429]22smbclient \- ftp\-like client to access SMB/CIFS resources on servers
[596]23.SH "SYNOPSIS"
[429]24.HP \w'\ 'u
[596]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>]
[429]26.HP \w'\ 'u
[596]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]
[429]28.SH "DESCRIPTION"
29.PP
30This tool is part of the
31\fBsamba\fR(7)
32suite\&.
33.PP
[596]34smbclient
[429]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
[596]42//server/service
[429]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
[596]48//smbserver/printer
[429]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
[596]55smbclient
[429]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
[596]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
[429]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
[596]157smbclient\&. For example: smbclient \-M FRED < mymessage\&.txt will send the message in the file
158mymessage\&.txt
[429]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
[596]225smbclient \-L host
[429]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
[596]253smb\&.conf
[429]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
[596]265smb\&.conf
[429]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
[596]331ps
[429]332command\&. To be safe always allow
[596]333rpcclient
[429]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
[596]342smb\&.conf
[429]343file\&. However, a command line setting will take precedence over settings in
[596]344smb\&.conf\&.
[429]345.RE
346.PP
347\-i|\-\-scope <scope>
348.RS 4
349This specifies a NetBIOS scope that
[596]350nmblookup
[429]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
[596]364smb\&.conf
[429]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
[596]371tar(1)
[429]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.\}