1
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>smbclient</title><link rel="stylesheet" href="../samba.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.74.0"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"><a name="smbclient.1"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>smbclient — ftp-like client to access SMB/CIFS resources
2
on servers</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="literal">smbclient</code> [-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>]</p></div><div class="cmdsynopsis"><p><code class="literal">smbclient</code> {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]</p></div></div><div class="refsect1" lang="en"><a name="id2483769"></a><h2>DESCRIPTION</h2><p>This tool is part of the <a class="citerefentry" href="samba.7.html"><span class="citerefentry"><span class="refentrytitle">samba</span>(7)</span></a> suite.</p><p><code class="literal">smbclient</code> is a client that can
1
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>smbclient</title><link rel="stylesheet" href="../samba.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" title="smbclient"><a name="smbclient.1"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>smbclient — ftp-like client to access SMB/CIFS resources
2
on servers</p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="literal">smbclient</code> [-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>]</p></div><div class="cmdsynopsis"><p><code class="literal">smbclient</code> {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]</p></div></div><div class="refsect1" title="DESCRIPTION"><a name="id2489738"></a><h2>DESCRIPTION</h2><p>This tool is part of the <a class="citerefentry" href="samba.7.html"><span class="citerefentry"><span class="refentrytitle">samba</span>(7)</span></a> suite.</p><p><code class="literal">smbclient</code> is a client that can
3
3
'talk' to an SMB/CIFS server. It offers an interface
4
4
similar to that of the ftp program (see <a class="citerefentry" href="ftp.1.html"><span class="citerefentry"><span class="refentrytitle">ftp</span>(1)</span></a>).
5
5
Operations include things like getting files from the server
6
6
to the local machine, putting files from the local machine to
7
7
the server, retrieving directory information from the server
8
and so on. </p></div><div class="refsect1" lang="en"><a name="id2483808"></a><h2>OPTIONS</h2><div class="variablelist"><dl><dt><span class="term">servicename</span></dt><dd><p>servicename is the name of the service
8
and so on. </p></div><div class="refsect1" title="OPTIONS"><a name="id2489777"></a><h2>OPTIONS</h2><div class="variablelist"><dl><dt><span class="term">servicename</span></dt><dd><p>servicename is the name of the service
9
9
you want to use on the server. A service name takes the form
10
10
<code class="filename">//server/service</code> where <em class="parameter"><code>server
11
11
</code></em> is the NetBIOS name of the SMB/CIFS server
40
40
suite to determine what naming services and in what order to resolve
41
41
host names to IP addresses. The option takes a space-separated
42
42
string of different name resolution options.</p><p>The options are :"lmhosts", "host", "wins" and "bcast". They
43
cause names to be resolved as follows:</p><div class="itemizedlist"><ul type="disc"><li><p><code class="constant">lmhosts</code>: Lookup an IP
43
cause names to be resolved as follows:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="constant">lmhosts</code>: Lookup an IP
44
44
address in the Samba lmhosts file. If the line in lmhosts has
45
45
no name type attached to the NetBIOS name (see
46
46
the <a class="citerefentry" href="lmhosts.5.html"><span class="citerefentry"><span class="refentrytitle">lmhosts</span>(5)</span></a> for details) then
47
any name type matches for lookup.</p></li><li><p><code class="constant">host</code>: Do a standard host
47
any name type matches for lookup.</p></li><li class="listitem"><p><code class="constant">host</code>: Do a standard host
48
48
name to IP address resolution, using the system <code class="filename">/etc/hosts
49
49
</code>, NIS, or DNS lookups. This method of name resolution
50
50
is operating system dependent, for instance on IRIX or Solaris this
51
51
may be controlled by the <code class="filename">/etc/nsswitch.conf</code>
52
52
file). Note that this method is only used if the NetBIOS name
53
53
type being queried is the 0x20 (server) name type, otherwise
54
it is ignored.</p></li><li><p><code class="constant">wins</code>: Query a name with
54
it is ignored.</p></li><li class="listitem"><p><code class="constant">wins</code>: Query a name with
55
55
the IP address listed in the <em class="parameter"><code>wins server</code></em>
56
56
parameter. If no WINS server has
57
been specified this method will be ignored.</p></li><li><p><code class="constant">bcast</code>: Do a broadcast on
57
been specified this method will be ignored.</p></li><li class="listitem"><p><code class="constant">bcast</code>: Do a broadcast on
58
58
each of the known local interfaces listed in the
59
59
<em class="parameter"><code>interfaces</code></em>
60
60
parameter. This is the least reliable of the name resolution
140
140
investigating a problem. Levels above 3 are designed for
141
141
use only by developers and generate HUGE amounts of log
142
142
data, most of which is extremely cryptic.</p><p>Note that specifying this parameter here will
143
override the <a class="link" href="smb.conf.5.html#LOGLEVEL" target="_top">log level</a> parameter
144
in the <code class="filename">smb.conf</code> file.</p></dd><dt><span class="term">-V</span></dt><dd><p>Prints the program version number.
145
</p></dd><dt><span class="term">-s <configuration file></span></dt><dd><p>The file specified contains the
143
override the <a class="link" href="smb.conf.5.html#" target="_top"></a> parameter
144
in the <code class="filename">smb.conf</code> file.</p></dd><dt><span class="term">-V|--version</span></dt><dd><p>Prints the program version number.
145
</p></dd><dt><span class="term">-s|--configfile <configuration file></span></dt><dd><p>The file specified contains the
146
146
configuration details required by the server. The
147
147
information in this file includes server-specific
148
148
information such as what printcap file to use, as well
152
152
compile time.</p></dd><dt><span class="term">-l|--log-basename=logdirectory</span></dt><dd><p>Base directory name for log/debug files. The extension
153
153
<code class="constant">".progname"</code> will be appended (e.g. log.smbclient,
154
154
log.smbd, etc...). The log file is never removed by the client.
155
</p></dd><dt><span class="term">-N</span></dt><dd><p>If specified, this parameter suppresses the normal
155
</p></dd><dt><span class="term">-N|--no-pass</span></dt><dd><p>If specified, this parameter suppresses the normal
156
156
password prompt from the client to the user. This is useful when
157
157
accessing a service that does not require a password. </p><p>Unless a password is specified on the command line or
158
158
this parameter is specified, the client will request a
159
159
password.</p><p>If a password is specified on the command line and this
160
160
option is also defined the password on the command line will
161
be silently ingnored and no password will be used.</p></dd><dt><span class="term">-k</span></dt><dd><p>
161
be silently ingnored and no password will be used.</p></dd><dt><span class="term">-k|--kerberos</span></dt><dd><p>
162
162
Try to authenticate with kerberos. Only useful in
163
163
an Active Directory environment.
164
164
</p></dd><dt><span class="term">-A|--authentication-file=filename</span></dt><dd><p>This option allows
183
183
many systems the command line of a running process may be seen
184
184
via the <code class="literal">ps</code> command. To be safe always allow
185
185
<code class="literal">rpcclient</code> to prompt for a password and type
186
it in directly. </p></dd><dt><span class="term">-n <primary NetBIOS name></span></dt><dd><p>This option allows you to override
186
it in directly. </p></dd><dt><span class="term">-n|--netbiosname <primary NetBIOS name></span></dt><dd><p>This option allows you to override
187
187
the NetBIOS name that Samba uses for itself. This is identical
188
to setting the <a class="link" href="smb.conf.5.html#NETBIOSNAME" target="_top">netbios name</a> parameter in the <code class="filename">smb.conf</code> file.
188
to setting the <a class="link" href="smb.conf.5.html#" target="_top"></a> parameter in the <code class="filename">smb.conf</code> file.
189
189
However, a command
190
190
line setting will take precedence over settings in
191
<code class="filename">smb.conf</code>.</p></dd><dt><span class="term">-i <scope></span></dt><dd><p>This specifies a NetBIOS scope that
191
<code class="filename">smb.conf</code>.</p></dd><dt><span class="term">-i|--scope <scope></span></dt><dd><p>This specifies a NetBIOS scope that
192
192
<code class="literal">nmblookup</code> will use to communicate with when
193
193
generating NetBIOS names. For details on the use of NetBIOS
194
194
scopes, see rfc1001.txt and rfc1002.txt. NetBIOS scopes are
198
198
overrides the default domain which is the domain defined in
199
199
smb.conf. If the domain specified is the same as the servers
200
200
NetBIOS name, it causes the client to log on using the servers local
201
SAM (as opposed to the Domain SAM). </p></dd><dt><span class="term">-O socket options</span></dt><dd><p>TCP socket options to set on the client
201
SAM (as opposed to the Domain SAM). </p></dd><dt><span class="term">-O|--socket-options socket options</span></dt><dd><p>TCP socket options to set on the client
202
202
socket. See the socket options parameter in
203
203
the <code class="filename">smb.conf</code> manual page for the list of valid
204
204
options. </p></dd><dt><span class="term">-T tar options</span></dt><dd><p>smbclient may be used to create <code class="literal">tar(1)
205
205
</code> compatible backups of all the files on an SMB/CIFS
206
206
share. The secondary tar flags that can be given to this option
207
are : </p><div class="itemizedlist"><ul type="disc"><li><p><em class="parameter"><code>c</code></em> - Create a tar file on UNIX.
207
are : </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><em class="parameter"><code>c</code></em> - Create a tar file on UNIX.
208
208
Must be followed by the name of a tar file, tape device
209
209
or "-" for standard output. If using standard output you must
210
210
turn the log level to its lowest value -d0 to avoid corrupting
211
211
your tar file. This flag is mutually exclusive with the
212
<em class="parameter"><code>x</code></em> flag. </p></li><li><p><em class="parameter"><code>x</code></em> - Extract (restore) a local
212
<em class="parameter"><code>x</code></em> flag. </p></li><li class="listitem"><p><em class="parameter"><code>x</code></em> - Extract (restore) a local
213
213
tar file back to a share. Unless the -D option is given, the tar
214
214
files will be restored from the top level of the share. Must be
215
215
followed by the name of the tar file, device or "-" for standard
216
216
input. Mutually exclusive with the <em class="parameter"><code>c</code></em> flag.
217
217
Restored files have their creation times (mtime) set to the
218
218
date saved in the tar file. Directories currently do not get
219
their creation dates restored properly. </p></li><li><p><em class="parameter"><code>I</code></em> - Include files and directories.
219
their creation dates restored properly. </p></li><li class="listitem"><p><em class="parameter"><code>I</code></em> - Include files and directories.
220
220
Is the default behavior when filenames are specified above. Causes
221
221
files to be included in an extract or create (and therefore
222
222
everything else to be excluded). See example below. Filename globbing
223
works in one of two ways. See <em class="parameter"><code>r</code></em> below. </p></li><li><p><em class="parameter"><code>X</code></em> - Exclude files and directories.
223
works in one of two ways. See <em class="parameter"><code>r</code></em> below. </p></li><li class="listitem"><p><em class="parameter"><code>X</code></em> - Exclude files and directories.
224
224
Causes files to be excluded from an extract or create. See
225
225
example below. Filename globbing works in one of two ways now.
226
See <em class="parameter"><code>r</code></em> below. </p></li><li><p><em class="parameter"><code>F</code></em> - File containing a list of files and directories.
226
See <em class="parameter"><code>r</code></em> below. </p></li><li class="listitem"><p><em class="parameter"><code>F</code></em> - File containing a list of files and directories.
227
227
The <em class="parameter"><code>F</code></em> causes the name following the tarfile to
228
228
create to be read as a filename that contains a list of files and directories to
229
229
be included in an extract or create (and therefore everything else to be excluded).
230
230
See example below. Filename globbing works in one of two ways.
231
231
See <em class="parameter"><code>r</code></em> below.
232
</p></li><li><p><em class="parameter"><code>b</code></em> - Blocksize. Must be followed
232
</p></li><li class="listitem"><p><em class="parameter"><code>b</code></em> - Blocksize. Must be followed
233
233
by a valid (greater than zero) blocksize. Causes tar file to be
234
234
written out in blocksize*TBLOCK (usually 512 byte) blocks.
235
</p></li><li><p><em class="parameter"><code>g</code></em> - Incremental. Only back up
235
</p></li><li class="listitem"><p><em class="parameter"><code>g</code></em> - Incremental. Only back up
236
236
files that have the archive bit set. Useful only with the
237
<em class="parameter"><code>c</code></em> flag. </p></li><li><p><em class="parameter"><code>q</code></em> - Quiet. Keeps tar from printing
237
<em class="parameter"><code>c</code></em> flag. </p></li><li class="listitem"><p><em class="parameter"><code>q</code></em> - Quiet. Keeps tar from printing
238
238
diagnostics as it works. This is the same as tarmode quiet.
239
</p></li><li><p><em class="parameter"><code>r</code></em> - Regular expression include
239
</p></li><li class="listitem"><p><em class="parameter"><code>r</code></em> - Regular expression include
240
240
or exclude. Uses regular expression matching for
241
241
excluding or excluding files if compiled with HAVE_REGEX_H.
242
242
However this mode can be very slow. If not compiled with
243
243
HAVE_REGEX_H, does a limited wildcard match on '*' and '?'.
244
</p></li><li><p><em class="parameter"><code>N</code></em> - Newer than. Must be followed
244
</p></li><li class="listitem"><p><em class="parameter"><code>N</code></em> - Newer than. Must be followed
245
245
by the name of a file whose date is compared against files found
246
246
on the share during a create. Only files newer than the file
247
247
specified are backed up to the tar file. Useful only with the
248
<em class="parameter"><code>c</code></em> flag. </p></li><li><p><em class="parameter"><code>a</code></em> - Set archive bit. Causes the
248
<em class="parameter"><code>c</code></em> flag. </p></li><li class="listitem"><p><em class="parameter"><code>a</code></em> - Set archive bit. Causes the
249
249
archive bit to be reset when a file is backed up. Useful with the
250
250
<em class="parameter"><code>g</code></em> and <em class="parameter"><code>c</code></em> flags.
251
251
</p></li></ul></div><p><span class="emphasis"><em>Tar Long File Names</em></span></p><p><code class="literal">smbclient</code>'s tar option now supports long
270
270
only of any use with the tar -T option. </p></dd><dt><span class="term">-c command string</span></dt><dd><p>command string is a semicolon-separated list of
271
271
commands to be executed instead of prompting from stdin. <em class="parameter"><code>
272
272
-N</code></em> is implied by <em class="parameter"><code>-c</code></em>.</p><p>This is particularly useful in scripts and for printing stdin
273
to the server, e.g. <code class="literal">-c 'print -'</code>. </p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id2533319"></a><h2>OPERATIONS</h2><p>Once the client is running, the user is presented with
273
to the server, e.g. <code class="literal">-c 'print -'</code>. </p></dd></dl></div></div><div class="refsect1" title="OPERATIONS"><a name="id2539287"></a><h2>OPERATIONS</h2><p>Once the client is running, the user is presented with
274
274
a prompt : </p><p><code class="prompt">smb:\> </code></p><p>The backslash ("\\") indicates the current working directory
275
275
on the server, and will change if the current working directory
276
276
is changed. </p><p>The prompt indicates that the client is ready and waiting to
468
468
</p></dd><dt><span class="term">vuid <number></span></dt><dd><p>Changes the currently used vuid in the protocol to
469
469
the given arbitrary number. Without an argument prints out the current
470
470
vuid being used. Used for internal Samba testing purposes.
471
</p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id2534409"></a><h2>NOTES</h2><p>Some servers are fussy about the case of supplied usernames,
471
</p></dd></dl></div></div><div class="refsect1" title="NOTES"><a name="id2487394"></a><h2>NOTES</h2><p>Some servers are fussy about the case of supplied usernames,
472
472
passwords, share names (AKA service names) and machine names.
473
473
If you fail to connect try giving all parameters in uppercase.
474
474
</p><p>It is often necessary to use the -n option when connecting
475
475
to some types of servers. For example OS/2 LanManager insists
476
476
on a valid NetBIOS name being used, so you need to supply a valid
477
477
name that would be known to the server.</p><p>smbclient supports long file names where the server
478
supports the LANMAN2 protocol or above. </p></div><div class="refsect1" lang="en"><a name="id2534434"></a><h2>ENVIRONMENT VARIABLES</h2><p>The variable <code class="envar">USER</code> may contain the
478
supports the LANMAN2 protocol or above. </p></div><div class="refsect1" title="ENVIRONMENT VARIABLES"><a name="id2487420"></a><h2>ENVIRONMENT VARIABLES</h2><p>The variable <code class="envar">USER</code> may contain the
479
479
username of the person using the client. This information is
480
480
used only if the protocol level is high enough to support
481
481
session-level passwords.</p><p>The variable <code class="envar">PASSWD</code> may contain
496
496
and writeable only by the user. </p><p>To test the client, you will need to know the name of a
497
497
running SMB/CIFS server. It is possible to run <a class="citerefentry" href="smbd.8.html"><span class="citerefentry"><span class="refentrytitle">smbd</span>(8)</span></a> as an ordinary user - running that server as a daemon
498
498
on a user-accessible port (typically any port number over 1024)
499
would provide a suitable test server. </p></div><div class="refsect1" lang="en"><a name="id2534523"></a><h2>DIAGNOSTICS</h2><p>Most diagnostics issued by the client are logged in a
499
would provide a suitable test server. </p></div><div class="refsect1" title="DIAGNOSTICS"><a name="id2540633"></a><h2>DIAGNOSTICS</h2><p>Most diagnostics issued by the client are logged in a
500
500
specified log file. The log file name is specified at compile time,
501
501
but may be overridden on the command line. </p><p>The number and nature of diagnostics available depends
502
502
on the debug level used by the client. If you have problems,
503
set the debug level to 3 and peruse the log files. </p></div><div class="refsect1" lang="en"><a name="id2534541"></a><h2>VERSION</h2><p>This man page is correct for version 3.2 of the Samba suite.</p></div><div class="refsect1" lang="en"><a name="id2534552"></a><h2>AUTHOR</h2><p>The original Samba software and related utilities
503
set the debug level to 3 and peruse the log files. </p></div><div class="refsect1" title="VERSION"><a name="id2540652"></a><h2>VERSION</h2><p>This man page is correct for version 3.2 of the Samba suite.</p></div><div class="refsect1" title="AUTHOR"><a name="id2540662"></a><h2>AUTHOR</h2><p>The original Samba software and related utilities
504
504
were created by Andrew Tridgell. Samba is now developed
505
505
by the Samba Team as an Open Source project similar
506
506
to the way the Linux kernel is developed.</p><p>The original Samba man pages were written by Karl Auer.