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