more updates.....
[kai/samba.git] / docs / htmldocs / smbclient.1.html
1
2
3  
4
5
6 <html><head><title>smbclient (1)</title>
7
8 <link rev="made" href="mailto:samba@samba.org">
9 </head>
10 <body>
11
12 <hr>
13
14 <h1>smbclient (1)</h1>
15 <h2>Samba</h2>
16 <h2>23 Oct 1998</h2>
17
18     
19
20     
21 <p><br><a name="NAME"></a>
22 <h2>NAME</h2>
23     smbclient - ftp-like client to access SMB/CIFS resources on servers
24 <p><br><a name="SYNOPSIS"></a>
25 <h2>SYNOPSIS</h2>
26     
27 <p><br><strong>smbclient</strong> <a href="smbclient.1.html#servicename">servicename</a> [<a href="smbclient.1.html#minuss">-s smb.conf</a>] [<a href="smbclient.1.html#minusO">-O socket options</a>][<a href="smbclient.1.html#minusR">-R name resolve order</a>] [<a href="smbclient.1.html#minusM">-M NetBIOS name</a>] [<a href="smbclient.1.html#minusi">-i scope</a>] [<a href="smbclient.1.html#minusN">-N</a>] [<a href="smbclient.1.html#minusn">-n NetBIOS name</a>] [<a href="smbclient.1.html#minusd">-d debuglevel</a>] [<a href="smbclient.1.html#minusP">-P</a>] [<a href="smbclient.1.html#minusp">-p port</a>] [<a href="smbclient.1.html#minusl">-l log basename</a>] [<a href="smbclient.1.html#minush">-h</a>] [<a href="smbclient.1.html#minusI">-I dest IP</a>] [<a href="smbclient.1.html#minusE">-E</a>] [<a href="smbclient.1.html#minusU">-U username</a>] [<a href="smbclient.1.html#minusL">-L NetBIOS name</a>] [<a href="smbclient.1.html#minust">-t terminal code</a>] [<a href="smbclient.1.html#minusm">-m max protocol</a>] [<a href="smbclient.1.html#minusb">-b buffersize</a>] [<a href="smbclient.1.html#minusW">-W workgroup</a>] [<a href="smbclient.1.html#minusT">-T&lt;c|x&gt;IXFqgbNan</a>] [<a href="smbclient.1.html#minusD">-D directory</a>] [<a href="smbclient.1.html#minusc">-c command string</a>]
28 <p><br><a name="DESCRIPTION"></a>
29 <h2>DESCRIPTION</h2>
30     
31 <p><br>This program is part of the <strong>Samba</strong> suite.
32 <p><br><strong>smbclient</strong> is a client that can 'talk' to an SMB/CIFS server. It
33 offers an interface similar to that of the ftp program (see <strong>ftp
34 (1)</strong>).  Operations include things like getting files from the server
35 to the local machine, putting files from the local machine to the
36 server, retrieving directory information from the server and so on.
37 <p><br><a name="OPTIONS"></a>
38 <h2>OPTIONS</h2>
39     
40 <p><br><ul>
41 <p><br><a name="servicename"></a>
42 <li><strong><strong>servicename</strong></strong> servicename is the name of the service you want
43 to use on the server. A service name takes the form
44 <code>//server/service</code> where <em>server</em> is the NetBIOS name of the SMB/CIFS
45 server offering the desired service and <em>service</em> is the name
46 of the service offered. Thus to connect to the service <em>printer</em> on
47 the SMB/CIFS server <em>smbserver</em>, you would use the servicename
48 <p><br><code>//smbserver/printer</code>
49 <p><br>Note that the server name required is NOT necessarily the IP (DNS)
50 host name of the server ! The name required is a NetBIOS server name,
51 which may or may not be the same as the IP hostname of the machine
52 running the server.
53 <p><br>The server name is looked up according to either the
54 <a href="smbclient.1.html#minusR"><strong>-R</strong></a> parameter to <strong>smbclient</strong> or using the
55 <a href="smb.conf.5.html#nameresolveorder"><strong>name resolve order</strong></a>
56 parameter in the smb.conf file, allowing an administrator to change
57 the order and methods by which server names are looked up.
58 <p><br><a name="password"></a>
59 <li><strong><strong>password</strong></strong> password is the password required to access the
60 specified service on the specified server. If this parameter is
61 supplied, the <a href="smbclient.1.html#minusN"><strong>-N</strong></a> option (suppress password prompt) is assumed.
62 <p><br>There is no default password. If no password is supplied on the
63 command line (either by using this parameter or adding a password to
64 the <a href="smbclient.1.html#minusU"><strong>-U</strong></a> option (see below)) and the <a href="smbclient.1.html#minusN"><strong>-N</strong></a> option is not specified,
65 the client will prompt for a password, even if the desired service
66 does not require one. (If no password is required, simply press ENTER
67 to provide a null password.)
68 <p><br>Note: Some servers (including OS/2 and Windows for Workgroups) insist
69 on an uppercase password. Lowercase or mixed case passwords may be
70 rejected by these servers.
71 <p><br>Be cautious about including passwords in scripts.
72 <p><br><a name="minuss"></a>
73 <li><strong><strong>-s smb.conf</strong></strong> This parameter specifies the pathname to the
74 Samba configuration file, smb.conf. This file controls all aspects of
75 the Samba setup on the machine and smbclient also needs to read this
76 file.
77 <p><br><a name="minusO"></a>
78 <li><strong><strong>-O socket options</strong></strong> TCP socket options to set on the client
79 socket. See the <a href="smb.conf.5.html#socketoptions">socket options</a>
80 parameter in the <a href="smb.conf.5.html"><strong>smb.conf (5)</strong></a> manpage for
81 the list of valid options.
82 <p><br><a name="minusR"></a>
83 <li><strong><strong>-R name resolve order</strong></strong> This option allows the user of
84 smbclient to determine what name resolution services to use when
85 looking up the NetBIOS name of the host being connected to.
86 <p><br>The options are :"lmhosts", "host", "wins" and "bcast". They cause
87 names to be resolved as follows :
88 <p><br><ul>
89 <p><br><li > <strong>lmhosts</strong> : Lookup an IP address in the Samba lmhosts file.
90 The lmhosts file is stored in the same directory as the
91 <a href="smb.conf.5.html"><strong>smb.conf</strong></a> file.
92 <p><br><li > <strong>host</strong> : Do a standard host name to IP address resolution,
93 using the system /etc/hosts, NIS, or DNS lookups. This method of name
94 resolution is operating system depended for instance on IRIX or
95 Solaris this may be controlled by the <em>/etc/nsswitch.conf</em> file).  
96 <p><br><li > <strong>wins</strong> : Query a name with the IP address listed in the <a href="smb.conf.5.html#winsserver"><strong>wins
97 server</strong></a> parameter in the smb.conf file. If 
98 no WINS server has been specified this method will be ignored.
99 <p><br><li > <strong>bcast</strong> : Do a broadcast on each of the known local interfaces
100 listed in the <a href="smb.conf.5.html#interfaces"><strong>interfaces</strong></a> parameter
101 in the smb.conf file. This is the least reliable of the name resolution
102 methods as it depends on the target host being on a locally connected
103 subnet. 
104 <p><br></ul>
105 <p><br>If this parameter is not set then the name resolve order defined
106 in the <a href="smb.conf.5.html"><strong>smb.conf</strong></a> file parameter 
107 <a href="smb.conf.5.html#nameresolveorder">(<strong>name resolve order</strong>)</a>
108 will be used.
109 <p><br>The default order is lmhosts, host, wins, bcast and without this
110 parameter or any entry in the <a href="smb.conf.5.html#nameresolveorder"><strong>"name resolve
111 order"</strong></a> parameter of the
112 <a href="smb.conf.5.html"><strong>smb.conf</strong></a> file the name resolution methods
113 will be attempted in this order.
114 <p><br><a name="minusM"></a>
115 <li><strong><strong>-M NetBIOS name</strong></strong> This options allows you to send messages,
116 using the "WinPopup" protocol, to another computer. Once a connection
117 is established you then type your message, pressing ^D (control-D) to
118 end.
119 <p><br>If the receiving computer is running WinPopup the user will receive
120 the message and probably a beep. If they are not running WinPopup the
121 message will be lost, and no error message will occur.
122 <p><br>The message is also automatically truncated if the message is over
123 1600 bytes, as this is the limit of the protocol.
124 <p><br>One useful trick is to cat the message through <strong>smbclient</strong>.
125 For example:
126 <p><br><code>cat mymessage.txt | smbclient -M FRED</code>
127 <p><br>will send the message in the file <em>mymessage.txt</em> to the machine FRED.
128 <p><br>You may also find the <a href="smbclient.1.html#minusU"><strong>-U</strong></a> and <a href="smbclient.1.html#minusI"><strong>-I</strong></a> options useful, as they allow
129 you to control the FROM and TO parts of the message.
130 <p><br>See the <a href="smb.conf.5.html#messagecommand"><strong>message command</strong></a>
131 parameter in the <strong>smb.conf (5)</strong> for a description of how to handle
132 incoming WinPopup messages in Samba.
133 <p><br>Note: Copy WinPopup into the startup group on your WfWg PCs if you
134 want them to always be able to receive messages.
135 <p><br><a name="minusi"></a>
136 <li><strong><strong>-i scope</strong></strong> This specifies a NetBIOS scope that smbclient will use
137 to communicate with when generating NetBIOS names. For details on the
138 use of NetBIOS scopes, see rfc1001.txt and rfc1002.txt. NetBIOS scopes
139 are <em>very</em> rarely used, only set this parameter if you are the
140 system administrator in charge of all the NetBIOS systems you
141 communicate with.
142 <p><br><a name="minusN"></a>
143 <li><strong><strong>-N</strong></strong> If specified, this parameter suppresses the normal
144 password prompt from the client to the user. This is useful when
145 accessing a service that does not require a password.
146 <p><br>Unless a password is specified on the command line or this parameter
147 is specified, the client will request a password.
148 <p><br><a name="minusn"></a>
149 <li><strong><strong>-n NetBIOS name</strong></strong> By default, the client will use the local
150 machine's hostname (in uppercase) as its NetBIOS name. This parameter
151 allows you to override the host name and use whatever NetBIOS name you
152 wish.
153 <p><br><a name="minusd"></a>
154 <li><strong><strong>-d debuglevel</strong></strong> debuglevel is an integer from 0 to 10, or the
155 letter 'A'.
156 <p><br>The default value if this parameter is not specified is zero.
157 <p><br>The higher this value, the more detail will be logged to the log files
158 about the activities of the client. At level 0, only critical errors
159 and serious warnings will be logged. Level 1 is a reasonable level for
160 day to day running - it generates a small amount of information about
161 operations carried out.
162 <p><br>Levels above 1 will generate considerable amounts of log data, and
163 should only be used when investigating a problem. Levels above 3 are
164 designed for use only by developers and generate HUGE amounts of log
165 data, most of which is extremely cryptic. If debuglevel is set to the
166 letter 'A', then <em>all</em> debug messages will be printed. This setting
167 is for developers only (and people who <em>really</em> want to know how the
168 code works internally).
169 <p><br>Note that specifying this parameter here will override the <a href="smb.conf.5.html#loglevel"><strong>log
170 level</strong></a> parameter in the <a href="smb.conf.5.html"><strong>smb.conf
171 (5)</strong></a> file.
172 <p><br><a name="minusP"></a>
173 <li><strong><strong>-P</strong></strong> This option is no longer used. The code in Samba2.0
174 now lets the server decide the device type, so no printer specific
175 flag is needed.
176 <p><br><a name="minusp"></a>
177 <li><strong><strong>-p port</strong></strong> This number is the TCP port number that will be used
178 when making connections to the server. The standard (well-known) TCP
179 port number for an SMB/CIFS server is 139, which is the default.
180 <p><br><a name="minusl"></a>
181 <li><strong><strong>-l logfilename</strong></strong> If specified, logfilename specifies a base
182 filename into which operational data from the running client will be
183 logged.
184 <p><br>The default base name is specified at compile time.
185 <p><br>The base name is used to generate actual log file names. For example,
186 if the name specified was "log", the debug file would be
187 <code>log.client</code>.
188 <p><br>The log file generated is never removed by the client.
189 <p><br><a name="minush"></a>
190 <li><strong><strong>-h</strong></strong> Print the usage message for the client.
191 <p><br><a name="minusI"></a>
192 <li><strong><strong>-I IP address</strong></strong> IP address is the address of the server to
193 connect to. It should be specified in standard "a.b.c.d" notation.
194 <p><br>Normally the client would attempt to locate a named SMB/CIFS server by
195 looking it up via the NetBIOS name resolution mechanism described
196 above in the <a href="smbclient.1.html#minusR"><strong>name resolve order</strong></a> parameter
197 above. Using this parameter will force the client to assume that the
198 server is on the machine with the specified IP address and the NetBIOS
199 name component of the resource being connected to will be ignored.
200 <p><br>There is no default for this parameter. If not supplied, it will be
201 determined automatically by the client as described above.
202 <p><br><a name="minusE"></a>
203 <li><strong><strong>-E</strong></strong> This parameter causes the client to write messages to the
204 standard error stream (stderr) rather than to the standard output
205 stream.
206 <p><br>By default, the client writes messages to standard output - typically
207 the user's tty.
208 <p><br><a name="minusU"></a>
209 <li><strong><strong>-U username</strong></strong> This specifies the user name that will be used by
210 the client to make a connection, assuming your server is not a downlevel
211 server that is running a protocol level that uses passwords on shares,
212 not on usernames.
213 <p><br>Some servers are fussy about the case of this name, and some insist
214 that it must be a valid NetBIOS name.
215 <p><br>If no username is supplied, it will default to an uppercase version of
216 the environment variable <code>USER</code> or <code>LOGNAME</code> in that order.  If no
217 username is supplied and neither environment variable exists the
218 username "GUEST" will be used.
219 <p><br>If the <code>USER</code> environment variable contains a '%' character,
220 everything after that will be treated as a password. This allows you
221 to set the environment variable to be <code>USER=username%password</code> so
222 that a password is not passed on the command line (where it may be
223 seen by the ps command).
224 <p><br>If the service you are connecting to requires a password, it can be
225 supplied using the <a href="smbclient.1.html#minusU"><strong>-U</strong></a> option, by appending a percent symbol ("%")
226 then the password to username.  For example, to attach to a service as
227 user <code>"fred"</code> with password <code>"secret"</code>, you would specify. <br>
228 <p><br><code>-U fred%secret</code> <br>
229 <p><br>on the command line. Note that there are no spaces around the percent
230 symbol.
231 <p><br>You can specify a domain name as part of the username by using a username of the form "DOMAIN/user" or "DOMAIN\user".
232 <p><br>If you specify the password as part of username then the <a href="smbclient.1.html#minusN"><strong>-N</strong></a> option
233 (suppress password prompt) is assumed.
234 <p><br>If you specify the password as a parameter <em>AND</em> as part of username
235 then the password as part of username will take precedence. Putting
236 nothing before or nothing after the percent symbol will cause an empty
237 username or an empty password to be used, respectively.
238 <p><br>The password may also be specified by setting up an environment
239 variable called <code>PASSWD</code> that contains the users password. Note
240 that this may be very insecure on some systems but on others allows
241 users to script smbclient commands without having a password appear in
242 the command line of a process listing.
243 <p><br>A third option is to use a credentials file which contains
244 the plaintext of the username and password.  This option is
245 mainly provided for scripts where the admin doesn't desire to
246 pass the credentials on the command line or via environment variables.
247 If this method is used, make certain that the permissions on the file
248 restrict access from unwanted users.  See the <strong>-A</strong> for more details.
249 <p><br>Note: Some servers (including OS/2 and Windows for Workgroups) insist
250 on an uppercase password. Lowercase or mixed case passwords may be
251 rejected by these servers.
252 <p><br>Be cautious about including passwords in scripts or in the
253 <code>PASSWD</code> environment variable. Also, on many systems the command
254 line of a running process may be seen via the <code>ps</code> command to be
255 safe always allow smbclient to prompt for a password and type it in
256 directly.
257 <p><br><a name="minusA"></a>
258 <li><strong><strong>-A &lt;filename&gt;</strong></strong> This option allows you to specify a file from which
259 to read the username and password used in the connection.  The format
260 of the file is
261 <p><br><code>username = &lt;value&gt;</code> <br>
262 <code>password = &lt;value</code> <br>
263 <p><br>Make certain that the permissions on the file restrict access from
264 unwanted users.
265 <p><br><a name="minusL"></a>
266 <li><strong><strong>-L</strong></strong> This option allows you to look at what services are
267 available on a server. You use it as <code>"smbclient -L host"</code> and a
268 list should appear.  The <a href="smbclient.1.html#minusI"><strong>-I</strong></a> option may be useful if your NetBIOS
269 names don't match your tcp/ip dns host names or if you are trying to
270 reach a host on another network.
271 <p><br><a name="minust"></a>
272 <li><strong><strong>-t terminal code</strong></strong> This option tells smbclient how to interpret
273 filenames coming from the remote server. Usually Asian language
274 multibyte UNIX implementations use different character sets than
275 SMB/CIFS servers (<em>EUC</em> instead of <em>SJIS</em> for example). Setting
276 this parameter will let smbclient convert between the UNIX filenames
277 and the SMB filenames correctly. This option has not been seriously
278 tested and may have some problems.
279 <p><br>The terminal codes include <code>sjis</code>, <code>euc</code>, <code>jis7</code>, <code>jis8</code>,
280 <code>junet</code>, <code>hex</code>, <code>cap</code>. This is not a complete list, check the
281 Samba source code for the complete list.
282 <p><br><a name="minusm"></a>
283 <li><strong><strong>-m max protocol level</strong></strong> With the new code in Samba2.0,
284 <strong>smbclient</strong> always attempts to connect at the maximum
285 protocols level the server supports. This parameter is
286 preserved for backwards compatibility, but any string
287 following the <strong>-m</strong> will be ignored.
288 <p><br><a name="minusb"></a>
289 <li><strong><strong>-b buffersize</strong></strong> This option changes the transmit/send buffer
290 size when getting or putting a file from/to the server. The default
291 is 65520 bytes. Setting this value smaller (to 1200 bytes) has been
292 observed to speed up file transfers to and from a Win9x server.
293 <p><br><a name="minusW"></a>
294 <li><strong><strong>-W WORKGROUP</strong></strong> Override the default workgroup specified in the
295 <a href="smb.conf.5.html#workgroup"><strong>workgroup</strong></a> parameter of the
296 <a href="smb.conf.5.html"><strong>smb.conf</strong></a> file for this connection. This may
297 be needed to connect to some servers.
298 <p><br><a name="minusT"></a> <li><strong><strong>-T tar options</strong></strong> smbclient may be used to create
299 <strong>tar (1)</strong> compatible backups of all the files on an SMB/CIFS
300 share. The secondary tar flags that can be given to this option are :
301 <p><br><ul>
302 <p><br><li><strong><strong>c</strong></strong> Create a tar file on UNIX. Must be followed by the
303         name of a tar file, tape device or <code>"-"</code> for standard output. If
304         using standard output you must turn the log level to its lowest value
305     <code>-d0</code> to avoid corrupting your tar file. This flag is
306         mutually exclusive with the <strong>x</strong> flag.
307 <p><br><li><strong><strong>x</strong></strong> Extract (restore) a local tar file back to a
308         share. Unless the <a href="smbclient.1.html#minusD"><strong>-D</strong></a> option is given, the tar files will be
309         restored from the top level of the share. Must be followed by the name
310         of the tar file, device or <code>"-"</code> for standard input. Mutually exclusive
311         with the <strong>c</strong> flag. Restored files have their creation times (mtime)
312         set to the date saved in the tar file. Directories currently do not
313         get their creation dates restored properly.
314 <p><br><li><strong><strong>I</strong></strong> Include files and directories. Is the default
315         behavior when filenames are specified above. Causes tar files to
316         be included in an extract or create (and therefore everything else to
317         be excluded). See example below.  Filename globbing works 
318         in one of two ways.  See <strong>r</strong> below.
319 <p><br><li><strong><strong>X</strong></strong> Exclude files and directories. Causes tar files to
320         be excluded from an extract or create. See example below.  Filename
321         globbing works in one of two ways now. See <strong>r</strong> below.
322 <p><br><li><strong><strong>b</strong></strong> Blocksize. Must be followed by a valid (greater than
323         zero) blocksize.  Causes tar file to be written out in
324         blocksize*TBLOCK (usually 512 byte) blocks.
325 <p><br><li><strong><strong>g</strong></strong> Incremental. Only back up files that have the
326         archive bit set. Useful only with the <strong>c</strong> flag.
327 <p><br><li><strong><strong>q</strong></strong> Quiet. Keeps tar from printing diagnostics as it
328         works.  This is the same as tarmode quiet.
329 <p><br><li><strong><strong>r</strong></strong> Regular expression include or exclude.  Uses regular 
330         regular expression matching for excluding or excluding files if 
331         compiled with HAVE_REGEX_H. However this mode can be very slow. If 
332         not compiled with HAVE_REGEX_H, does a limited wildcard match on * and 
333         ?.
334 <p><br><li><strong><strong>N</strong></strong> Newer than. Must be followed by the name of a file
335         whose date is compared against files found on the share during a
336         create. Only files newer than the file specified are backed up to the
337         tar file. Useful only with the <strong>c</strong> flag.
338 <p><br><li><strong><strong>a</strong></strong> Set archive bit. Causes the archive bit to be reset
339         when a file is backed up. Useful with the <strong>g</strong> and <strong>c</strong> flags.
340 <p><br></ul>
341 <p><br><em>Tar Long File Names</em>
342 <p><br>smbclient's tar option now supports long file names both on backup and
343 restore. However, the full path name of the file must be less than
344 1024 bytes.  Also, when a tar archive is created, smbclient's tar
345 option places all files in the archive with relative names, not
346 absolute names.
347 <p><br><em>Tar Filenames</em>
348 <p><br>All file names can be given as DOS path names (with <code>\</code> as the
349 component separator) or as UNIX path names (with <code>/</code> as the
350 component separator).
351 <p><br><em>Examples</em>
352 <p><br><ul>
353 <p><br><li > Restore from tar file backup.tar into myshare on mypc (no password on share).
354 <p><br><code>smbclient //mypc/myshare "" -N -Tx backup.tar</code>
355 <p><br><li > Restore everything except users/docs
356 <p><br><code>smbclient //mypc/myshare "" -N -TXx backup.tar users/docs</code>
357 <p><br><li > Create a tar file of the files beneath users/docs.
358 <p><br><code>smbclient //mypc/myshare "" -N -Tc backup.tar users/docs</code>
359 <p><br><li > Create the same tar file as above, but now use a DOS path name.
360 <p><br><code>smbclient //mypc/myshare "" -N -tc backup.tar users\edocs</code>
361 <p><br><li > Create a tar file of all the files and directories in the share.
362 <p><br><code>smbclient //mypc/myshare "" -N -Tc backup.tar *</code>
363 <p><br></ul>
364 <p><br><a name="minusD"></a>
365 <li><strong><strong>-D initial directory</strong></strong> Change to initial directory before
366 starting. Probably only of any use with the tar <a href="smbclient.1.html#minusT"><strong>-T</strong></a> option.
367 <p><br><a name="minusc"></a>
368 <li><strong><strong>-c command string</strong></strong> command string is a semicolon separated
369 list of commands to be executed instead of prompting from stdin.
370 <a href="smbclient.1.html#minusN"><strong>-N</strong></a> is implied by <strong>-c</strong>.
371 <p><br>This is particularly useful in scripts and for printing stdin to the
372 server, e.g. <code>-c 'print -'</code>.
373 <p><br></ul>
374 <p><br><a name="OPERATIONS"></a>
375 <h2>OPERATIONS</h2>
376     
377 <p><br>Once the client is running, the user is presented with a prompt :
378 <p><br><code>smb:\&gt;</code>
379 <p><br>The backslash ("\") indicates the current working directory on the
380 server, and will change if the current working directory is changed.
381 <p><br>The prompt indicates that the client is ready and waiting to carry out
382 a user command. Each command is a single word, optionally followed by
383 parameters specific to that command. Command and parameters are
384 space-delimited unless these notes specifically state otherwise. All
385 commands are case-insensitive.  Parameters to commands may or may not
386 be case sensitive, depending on the command.
387 <p><br>You can specify file names which have spaces in them by quoting the
388 name with double quotes, for example "a long file name".
389 <p><br>Parameters shown in square brackets (e.g., "[parameter]") are
390 optional. If not given, the command will use suitable
391 defaults. Parameters shown in angle brackets (e.g., "&lt;parameter&gt;") are
392 required.
393 <p><br>Note that all commands operating on the server are actually performed
394 by issuing a request to the server. Thus the behavior may vary from
395 server to server, depending on how the server was implemented.
396 <p><br>The commands available are given here in alphabetical order.
397 <p><br><ul>
398 <p><br><a name="questionmark"></a> <li><strong><strong>? [command]</strong></strong> If "command" is specified,
399 the <strong>?</strong> command will display a brief informative message about the
400 specified command.  If no command is specified, a list of available
401 commands will be displayed.
402 <p><br><a name="exclaimationmark"></a> <li><strong><strong>! [shell command]</strong></strong> If "shell command"
403 is specified, the <strong>!</strong>  command will execute a shell locally and run
404 the specified shell command. If no command is specified, a local shell
405 will be run.
406 <p><br><a name="cd"></a> <li><strong><strong>cd [directory name]</strong></strong> If "directory name" is
407 specified, the current working directory on the server will be changed
408 to the directory specified. This operation will fail if for any reason
409 the specified directory is inaccessible.
410 <p><br>If no directory name is specified, the current working directory on
411 the server will be reported.
412 <p><br><a name="del"></a> <li><strong><strong>del &lt;mask&gt;</strong></strong> The client will request that the server
413 attempt to delete all files matching "mask" from the current working
414 directory on the server.
415 <p><br><a name="dir"></a> <li><strong><strong>dir &lt;mask&gt;</strong></strong> A list of the files matching "mask" in
416 the current working directory on the server will be retrieved from the
417 server and displayed.
418 <p><br><a name="exit"></a> <li><strong><strong>exit</strong></strong> Terminate the connection with the server and
419 exit from the program.
420 <p><br><a name="get"></a> <li><strong><strong>get &lt;remote file name&gt; [local file name]</strong></strong> Copy the
421 file called "remote file name" from the server to the machine running
422 the client. If specified, name the local copy "local file name".  Note
423 that all transfers in smbclient are binary. See also the
424 <a href="smbclient.1.html#lowercase"><strong>lowercase</strong></a> command.
425 <p><br><a name="help"></a> <li><strong><strong>help [command]</strong></strong> See the <a href="smbclient.1.html#questionmark"><strong>?</strong></a>
426 command above.
427 <p><br><a name="lcd"></a> <li><strong><strong>lcd [directory name]</strong></strong> If "directory name" is
428 specified, the current working directory on the local machine will
429 be changed to the directory specified. This operation will fail if for
430 any reason the specified directory is inaccessible.
431 <p><br>If no directory name is specified, the name of the current working
432 directory on the local machine will be reported.
433 <p><br><a name="lowercase"></a> <li><strong><strong>lowercase</strong></strong> Toggle lowercasing of filenames
434 for the <a href="smbclient.1.html#get"><strong>get</strong></a> and <a href="smbclient.1.html#mget"><strong>mget</strong></a> commands.
435 <p><br>When lowercasing is toggled ON, local filenames are converted to
436 lowercase when using the <a href="smbclient.1.html#get"><strong>get</strong></a> and <a href="smbclient.1.html#mget"><strong>mget</strong></a>
437 commands. This is often useful when copying (say) MSDOS files from a
438 server, because lowercase filenames are the norm on UNIX systems.
439 <p><br><a name="ls"></a> <li><strong><strong>ls &lt;mask&gt;</strong></strong> See the <a href="smbclient.1.html#dir"><strong>dir</strong></a> command above.
440 <p><br><a name="mask"></a> <li><strong><strong>mask &lt;mask&gt;</strong></strong> This command allows the user to set
441 up a mask which will be used during recursive operation of the
442 <a href="smbclient.1.html#mget"><strong>mget</strong></a> and <a href="smbclient.1.html#mput"><strong>mput</strong></a> commands.
443 <p><br>The masks specified to the <a href="smbclient.1.html#mget"><strong>mget</strong></a> and
444 <a href="smbclient.1.html#mput"><strong>mput</strong></a> commands act as filters for directories rather
445 than files when recursion is toggled ON.
446 <p><br>The mask specified with the .B mask command is necessary to filter
447 files within those directories. For example, if the mask specified in
448 an <a href="smbclient.1.html#mget"><strong>mget</strong></a> command is "source*" and the mask specified
449 with the mask command is "*.c" and recursion is toggled ON, the
450 <a href="smbclient.1.html#mget"><strong>mget</strong></a> command will retrieve all files matching "*.c" in
451 all directories below and including all directories matching "source*"
452 in the current working directory.
453 <p><br>Note that the value for mask defaults to blank (equivalent to "*") and
454 remains so until the mask command is used to change it. It retains the
455 most recently specified value indefinitely. To avoid unexpected
456 results it would be wise to change the value of .I mask back to "*"
457 after using the <a href="smbclient.1.html#mget"><strong>mget</strong></a> or <a href="smbclient.1.html#mput"><strong>mput</strong></a> commands.
458 <p><br><a name="md"></a> <li><strong><strong>md &lt;directory name&gt;</strong></strong> See the <a href="smbclient.1.html#mkdir"><strong>mkdir</strong></a>
459 command.
460 <p><br><a name="mget"></a> <li><strong><strong>mget &lt;mask&gt;</strong></strong> Copy all files matching mask from the
461 server to the machine running the client.
462 <p><br>Note that mask is interpreted differently during recursive operation
463 and non-recursive operation - refer to the <a href="smbclient.1.html#recurse"><strong>recurse</strong></a>
464 and <a href="smbclient.1.html#mask"><strong>mask</strong></a> commands for more information. Note that all
465 transfers in .B smbclient are binary. See also the
466 <a href="smbclient.1.html#lowercase"><strong>lowercase</strong></a> command.
467 <p><br><a name="mkdir"></a> <li><strong><strong>mkdir &lt;directory name&gt;</strong></strong> Create a new directory on
468 the server (user access privileges permitting) with the specified
469 name.
470 <p><br><a name="mput"></a> <li><strong><strong>mput &lt;mask&gt;</strong></strong> Copy all files matching mask in
471 the current working directory on the local machine to the current
472 working directory on the server.
473 <p><br>Note that mask is interpreted differently during recursive operation
474 and non-recursive operation - refer to the <a href="smbclient.1.html#recurse"><strong>recurse</strong></a>
475 and <a href="smbclient.1.html#mask"><strong>mask</strong></a> commands for more information. Note that all
476 transfers in .B smbclient are binary.
477 <p><br><a name="print"></a> <li><strong><strong>print &lt;file name&gt;</strong></strong> Print the specified file
478 from the local machine through a printable service on the server.
479 <p><br>See also the <a href="smbclient.1.html#printmode"><strong>printmode</strong></a> command.
480 <p><br><a name="printmode"></a> <li><strong><strong>printmode &lt;graphics or text&gt;</strong></strong> Set the print
481 mode to suit either binary data (such as graphical information) or
482 text. Subsequent print commands will use the currently set print
483 mode.
484 <p><br><a name="prompt"></a> <li><strong><strong>prompt</strong></strong> Toggle prompting for filenames during
485 operation of the <a href="smbclient.1.html#mget"><strong>mget</strong></a> and <a href="smbclient.1.html#mput"><strong>mput</strong></a>
486 commands.
487 <p><br>When toggled ON, the user will be prompted to confirm the transfer of
488 each file during these commands. When toggled OFF, all specified files
489 will be transferred without prompting.
490 <p><br><a name="put"></a> <li><strong><strong>put &lt;local file name&gt; [remote file name]</strong></strong> Copy the
491 file called "local file name" from the machine running the client to
492 the server. If specified, name the remote copy "remote file name".
493 Note that all transfers in smbclient are binary. See also the
494 <a href="smbclient.1.html#lowercase"><strong>lowercase</strong></a> command.
495 <p><br><a name="queue"></a> <li><strong><strong>queue</strong></strong> Displays the print queue, showing the job
496 id, name, size and current status.
497 <p><br><a name="quit"></a> <li><strong><strong>quit</strong></strong> See the <a href="smbclient.1.html#exit"><strong>exit</strong></a> command.
498 <p><br><a name="rd"></a> <li><strong><strong>rd &lt;directory name&gt;</strong></strong> See the <a href="smbclient.1.html#rmdir"><strong>rmdir</strong></a>
499 command.
500 <p><br><a name="recurse"></a> <li><strong><strong>recurse</strong></strong> Toggle directory recursion for the
501 commands <a href="smbclient.1.html#mget"><strong>mget</strong></a> and <a href="smbclient.1.html#mput"><strong>mput</strong></a>.
502 <p><br>When toggled ON, these commands will process all directories in the
503 source directory (i.e., the directory they are copying .IR from ) and
504 will recurse into any that match the mask specified to the
505 command. Only files that match the mask specified using the
506 <a href="smbclient.1.html#mask"><strong>mask</strong></a> command will be retrieved. See also the
507 <a href="smbclient.1.html#mask"><strong>mask</strong></a> command.
508 <p><br>When recursion is toggled OFF, only files from the current working
509 directory on the source machine that match the mask specified to the
510 <a href="smbclient.1.html#mget"><strong>mget</strong></a> or <a href="smbclient.1.html#mput"><strong>mput</strong></a> commands will be copied,
511 and any mask specified using the <a href="smbclient.1.html#mask"><strong>mask</strong></a> command will be
512 ignored.
513 <p><br><a name="rm"></a> <li><strong><strong>rm &lt;mask&gt;</strong></strong> Remove all files matching mask from
514 the current working directory on the server.
515 <p><br><a name="rmdir"></a> <li><strong><strong>rmdir &lt;directory name&gt;</strong></strong> Remove the specified
516 directory (user access privileges permitting) from the server.
517 <p><br><a name="tar"></a> <li><strong><strong>tar &lt;c|x&gt;[IXbgNa]</strong></strong> Performs a tar operation - see
518 the <a href="smbclient.1.html#minusT"><strong>-T</strong></a> command line option above. Behavior may be
519 affected by the <a href="smbclient.1.html#tarmode"><strong>tarmode</strong></a> command (see below). Using
520 g (incremental) and N (newer) will affect tarmode settings. Note that
521 using the "-" option with tar x may not work - use the command line
522 option instead.
523 <p><br><a name="blocksize"></a> <li><strong><strong>blocksize &lt;blocksize&gt;</strong></strong> Blocksize. Must be
524 followed by a valid (greater than zero) blocksize. Causes tar file to
525 be written out in blocksize*TBLOCK (usually 512 byte) blocks.
526 <p><br><a name="tarmode"></a> <li><strong><strong>tarmode &lt;full|inc|reset|noreset&gt;</strong></strong> Changes tar's
527 behavior with regard to archive bits. In full mode, tar will back up
528 everything regardless of the archive bit setting (this is the default
529 mode). In incremental mode, tar will only back up files with the
530 archive bit set. In reset mode, tar will reset the archive bit on all
531 files it backs up (implies read/write share).
532 <p><br><a name="setmode"></a> <li><strong><strong>setmode &lt;filename&gt; &lt;perm=[+|\-]rsha&gt;</strong></strong> A version
533 of the DOS attrib command to set file permissions. For example:
534 <p><br><code>setmode myfile +r</code>
535 <p><br>would make myfile read only.
536 <p><br></ul>
537 <p><br><a name="NOTES"></a>
538 <h2>NOTES</h2>
539     
540 <p><br>Some servers are fussy about the case of supplied usernames,
541 passwords, share names (AKA service names) and machine names. If you
542 fail to connect try giving all parameters in uppercase.
543 <p><br>It is often necessary to use the <a href="smbclient.1.html#minusn"><strong>-n</strong></a> option when connecting to some
544 types of servers. For example OS/2 LanManager insists on a valid
545 NetBIOS name being used, so you need to supply a valid name that would
546 be known to the server.
547 <p><br>smbclient supports long file names where the server supports the
548 LANMAN2 protocol or above.
549 <p><br><a name="ENVIRONMENTVARIABLES"></a>
550 <h2>ENVIRONMENT VARIABLES</h2>
551     
552 <p><br>The variable <strong>USER</strong> may contain the username of the person using the
553 client.  This information is used only if the protocol level is high
554 enough to support session-level passwords.
555 <p><br>The variable <strong>PASSWD</strong> may contain the password of the person using
556 the client.  This information is used only if the protocol level is
557 high enough to support session-level passwords.
558 <p><br><a name="INSTALLATION"></a>
559 <h2>INSTALLATION</h2>
560     
561 <p><br>The location of the client program is a matter for individual system
562 administrators. The following are thus suggestions only.
563 <p><br>It is recommended that the smbclient software be installed in the
564 /usr/local/samba/bin or /usr/samba/bin directory, this directory
565 readable by all, writeable only by root. The client program itself
566 should be executable by all. The client should <em>NOT</em> be setuid or
567 setgid!
568 <p><br>The client log files should be put in a directory readable and
569 writeable only by the user.
570 <p><br>To test the client, you will need to know the name of a running
571 SMB/CIFS server. It is possible to run <a href="smbd.8.html"><strong>smbd (8)</strong></a>
572 an ordinary user - running that server as a daemon on a
573 user-accessible port (typically any port number over 1024) would
574 provide a suitable test server.
575 <p><br><a name="DIAGNOSTICS"></a>
576 <h2>DIAGNOSTICS</h2>
577     
578 <p><br>Most diagnostics issued by the client are logged in a specified log
579 file. The log file name is specified at compile time, but may be
580 overridden on the command line.
581 <p><br>The number and nature of diagnostics available depends on the debug
582 level used by the client. If you have problems, set the debug level to
583 3 and peruse the log files.
584 <p><br><a name="VERSION"></a>
585 <h2>VERSION</h2>
586     
587 <p><br>This man page is correct for version 2.0 of the Samba suite.
588 <p><br><a name="AUTHOR"></a>
589 <h2>AUTHOR</h2>
590     
591 <p><br>The original Samba software and related utilities were created by
592 Andrew Tridgell <a href="mailto:samba@samba.org"><em>samba@samba.org</em></a>. Samba is now developed
593 by the Samba Team as an Open Source project similar to the way the
594 Linux kernel is developed.
595 <p><br>The original Samba man pages were written by Karl Auer. The man page
596 sources were converted to YODL format (another excellent piece of Open
597 Source software, available at
598 <a href="ftp://ftp.icce.rug.nl/pub/unix/"><strong>ftp://ftp.icce.rug.nl/pub/unix/</strong></a>)
599 and updated for the Samba2.0 release by Jeremy Allison.
600 <a href="mailto:samba@samba.org"><em>samba@samba.org</em></a>.
601 <p><br>See <a href="samba.7.html"><strong>samba (7)</strong></a> to find out how to get a full
602 list of contributors and details on how to submit bug reports,
603 comments etc.
604 </body>
605 </html>