version 2, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
SMBCLIENT |
|
|
2 |
!!!SMBCLIENT |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
OPTIONS |
|
|
7 |
OPERATIONS |
|
|
8 |
NOTES |
|
|
9 |
ENVIRONMENT VARIABLES |
|
|
10 |
INSTALLATION |
|
|
11 |
DIAGNOSTICS |
|
|
12 |
VERSION |
|
|
13 |
AUTHOR |
|
|
14 |
---- |
|
|
15 |
!!NAME |
|
|
16 |
|
|
|
17 |
|
|
|
18 |
smbclient - ftp-like client to access SMB/CIFS resources on servers |
|
|
19 |
!!SYNOPSIS |
|
|
20 |
|
|
|
21 |
|
|
|
22 |
__smbclient servicename__ [[ __password__ ] [[ __-b |
|
|
23 |
__ ] [[ __-d debuglevel__ ] [[ __-D |
|
|
24 |
Directory__ ] [[ __-U username__ ] [[ __-W workgroup__ |
|
|
25 |
] [[ __-M __ ] [[ __-m maxprotocol__ |
|
|
26 |
] [[ __-A authfile__ ] [[ __-N__ ] [[ __-l logfile__ ] |
|
|
27 |
[[ __-L __ ] [[ __-I destinationIP__ |
|
|
28 |
] [[ __-E __ ] [[ __-c |
|
|
29 |
__ ] [[ __-i scope__ ] [[ __-O |
|
|
30 |
__ ] [[ __-p port__ ] [[ __-R |
|
|
31 |
__ ] [[ __-s __ |
|
|
32 |
] [[ __-T__ ] |
|
|
33 |
!!DESCRIPTION |
|
|
34 |
|
|
|
35 |
|
|
|
36 |
This tool is part of the Sambasuite. |
|
|
37 |
|
|
|
38 |
|
|
|
39 |
__smbclient__ is a client that can 'talk' to an SMB/CIFS |
|
|
40 |
server. It offers an interface similar to that of the ftp |
|
|
41 |
program (see __ftp(1)__). Operations include things like |
|
|
42 |
getting files from the server to the local machine, putting |
|
|
43 |
files from the local machine to the server, retrieving |
|
|
44 |
directory information from the server and so |
|
|
45 |
on. |
|
|
46 |
!!OPTIONS |
|
|
47 |
|
|
|
48 |
|
|
|
49 |
__servicename__ |
|
|
50 |
|
|
|
51 |
|
|
|
52 |
servicename is the name of the service you want to use on |
|
|
53 |
the server. A service name takes the form |
|
|
54 |
''//server/service'' where ''server'' is the NetBIOS |
|
|
55 |
name of the SMB/CIFS server offering the desired service and |
|
|
56 |
''service'' is the name of the service offered. Thus to |
|
|
57 |
connect to the service |
|
|
58 |
''//smbserver/printer'' |
|
|
59 |
|
|
|
60 |
|
|
|
61 |
Note that the server name required is NOT necessarily the IP |
|
|
62 |
(DNS) host name of the server ! The name required is a |
|
|
63 |
NetBIOS server name, which may or may not be the same as the |
|
|
64 |
IP hostname of the machine running the server. |
|
|
65 |
|
|
|
66 |
|
|
|
67 |
The server name is looked up according to either the |
|
|
68 |
''-R'' parameter to __smbclient__ or using the name |
|
|
69 |
resolve order parameter in the ''smb.conf'' file, |
|
|
70 |
allowing an administrator to change the order and methods by |
|
|
71 |
which server names are looked up. |
|
|
72 |
|
|
|
73 |
|
|
|
74 |
__password__ |
|
|
75 |
|
|
|
76 |
|
|
|
77 |
The password required to access the specified service on the |
|
|
78 |
specified server. If this parameter is supplied, the |
|
|
79 |
''-N'' option (suppress password prompt) is |
|
|
80 |
assumed. |
|
|
81 |
|
|
|
82 |
|
|
|
83 |
There is no default password. If no password is supplied on |
|
|
84 |
the command line (either by using this parameter or adding a |
|
|
85 |
password to the ''-U'' option (see below)) and the |
|
|
86 |
''-N'' option is not specified, the client will prompt |
|
|
87 |
for a password, even if the desired service does not require |
|
|
88 |
one. (If no password is required, simply press ENTER to |
|
|
89 |
provide a null password.) |
|
|
90 |
|
|
|
91 |
|
|
|
92 |
Note: Some servers (including OS/2 and Windows for |
|
|
93 |
Workgroups) insist on an uppercase password. Lowercase or |
|
|
94 |
mixed case passwords may be rejected by these |
|
|
95 |
servers. |
|
|
96 |
|
|
|
97 |
|
|
|
98 |
Be cautious about including passwords in |
|
|
99 |
scripts. |
|
|
100 |
|
|
|
101 |
|
|
|
102 |
__-s smb.conf__ |
|
|
103 |
|
|
|
104 |
|
|
|
105 |
Specifies the location of the all important ''smb.conf'' |
|
|
106 |
file. |
|
|
107 |
|
|
|
108 |
|
|
|
109 |
__-O socket options__ |
|
|
110 |
|
|
|
111 |
|
|
|
112 |
TCP socket options to set on the client socket. See the |
|
|
113 |
socket options parameter in the ''smb.conf (5)'' manpage |
|
|
114 |
for the list of valid options. |
|
|
115 |
|
|
|
116 |
|
|
|
117 |
__-R __ |
|
|
118 |
|
|
|
119 |
|
|
|
120 |
This option is used by the programs in the Samba suite to |
|
|
121 |
determine what naming services and in what order to resolve |
|
|
122 |
host names to IP addresses. The option takes a |
|
|
123 |
space-separated string of different name resolution |
|
|
124 |
options. |
|
|
125 |
|
|
|
126 |
|
|
|
127 |
The options are : |
|
|
128 |
|
|
|
129 |
|
|
|
130 |
lmhosts : Lookup an IP address in the Samba lmhosts file. If |
|
|
131 |
the line in lmhosts has no name type attached to the NetBIOS |
|
|
132 |
name (see the lmhosts(5)for details) then any name type |
|
|
133 |
matches for lookup. |
|
|
134 |
|
|
|
135 |
|
|
|
136 |
host : Do a standard host name to IP address resolution, |
|
|
137 |
using the system ''/etc/hosts'' , NIS, or DNS lookups. |
|
|
138 |
This method of name resolution is operating system |
|
|
139 |
dependent, for instance on IRIX or Solaris this may be |
|
|
140 |
controlled by the ''/etc/nsswitch.conf'' file). Note that |
|
|
141 |
this method is only used if the NetBIOS name type being |
|
|
142 |
queried is the 0x20 (server) name type, otherwise it is |
|
|
143 |
ignored. |
|
|
144 |
|
|
|
145 |
|
|
|
146 |
wins : Query a name with the IP address listed in the |
|
|
147 |
''wins server'' parameter. If no WINS server has been |
|
|
148 |
specified this method will be ignored. |
|
|
149 |
|
|
|
150 |
|
|
|
151 |
bcast : Do a broadcast on each of the known local interfaces |
|
|
152 |
listed in the ''interfaces'' parameter. This is the least |
|
|
153 |
reliable of the name resolution methods as it depends on the |
|
|
154 |
target host being on a locally connected |
|
|
155 |
subnet. |
|
|
156 |
|
|
|
157 |
|
|
|
158 |
If this parameter is not set then the name resolve order |
|
|
159 |
defined in the ''smb.conf'' file parameter (name resolve |
|
|
160 |
order) will be used. |
|
|
161 |
|
|
|
162 |
|
|
|
163 |
The default order is lmhosts, host, wins, bcast and without |
|
|
164 |
this parameter or any entry in the ''name resolve order'' |
|
|
165 |
parameter of the ''smb.conf'' file the name resolution |
|
|
166 |
methods will be attempted in this order. |
|
|
167 |
|
|
|
168 |
|
|
|
169 |
__-M NetBIOS name__ |
|
|
170 |
|
|
|
171 |
|
|
|
172 |
This options allows you to send messages, using the |
|
|
173 |
|
|
|
174 |
|
2 |
perry |
175 |
If the receiving computer is running !WinPopup the user will |
1 |
perry |
176 |
receive the message and probably a beep. If they are not |
2 |
perry |
177 |
running !WinPopup the message will be lost, and no error |
1 |
perry |
178 |
message will occur. |
|
|
179 |
|
|
|
180 |
|
|
|
181 |
The message is also automatically truncated if the message |
|
|
182 |
is over 1600 bytes, as this is the limit of the |
|
|
183 |
protocol. |
|
|
184 |
|
|
|
185 |
|
|
|
186 |
One useful trick is to cat the message through |
|
|
187 |
__smbclient__. For example: __cat mymessage.txt | |
|
|
188 |
smbclient -M FRED__ will send the message in the file |
|
|
189 |
''mymessage.txt'' to the machine FRED. |
|
|
190 |
|
|
|
191 |
|
|
|
192 |
You may also find the ''-U'' and ''-I'' options |
|
|
193 |
useful, as they allow you to control the FROM and TO parts |
|
|
194 |
of the message. |
|
|
195 |
|
|
|
196 |
|
|
|
197 |
See the message command parameter in the ''smb.conf(5)'' |
2 |
perry |
198 |
for a description of how to handle incoming !WinPopup |
1 |
perry |
199 |
messages in Samba. |
|
|
200 |
|
|
|
201 |
|
2 |
perry |
202 |
__Note__: Copy !WinPopup into the startup group on your |
|
|
203 |
!WfWg PCs if you want them to always be able to receive |
1 |
perry |
204 |
messages. |
|
|
205 |
|
|
|
206 |
|
|
|
207 |
__-i scope__ |
|
|
208 |
|
|
|
209 |
|
|
|
210 |
This specifies a NetBIOS scope that smbclient will use to |
|
|
211 |
communicate with when generating NetBIOS names. For details |
|
|
212 |
on the use of NetBIOS scopes, see ''rfc1001.txt'' and |
|
|
213 |
''rfc1002.txt''. NetBIOS scopes are __very__ rarely |
|
|
214 |
used, only set this parameter if you are the system |
|
|
215 |
administrator in charge of all the NetBIOS systems you |
|
|
216 |
communicate with. |
|
|
217 |
|
|
|
218 |
|
|
|
219 |
__-N__ |
|
|
220 |
|
|
|
221 |
|
|
|
222 |
If specified, this parameter suppresses the normal password |
|
|
223 |
prompt from the client to the user. This is useful when |
|
|
224 |
accessing a service that does not require a |
|
|
225 |
password. |
|
|
226 |
|
|
|
227 |
|
|
|
228 |
Unless a password is specified on the command line or this |
|
|
229 |
parameter is specified, the client will request a |
|
|
230 |
password. |
|
|
231 |
|
|
|
232 |
|
|
|
233 |
__-n NetBIOS name__ |
|
|
234 |
|
|
|
235 |
|
|
|
236 |
By default, the client will use the local machine's hostname |
|
|
237 |
(in uppercase) as its NetBIOS name. This parameter allows |
|
|
238 |
you to override the host name and use whatever NetBIOS name |
|
|
239 |
you wish. |
|
|
240 |
|
|
|
241 |
|
|
|
242 |
__-d debuglevel__ |
|
|
243 |
|
|
|
244 |
|
|
|
245 |
''debuglevel'' is an integer from 0 to 10, or the letter |
|
|
246 |
'A'. |
|
|
247 |
|
|
|
248 |
|
|
|
249 |
The default value if this parameter is not specified is |
|
|
250 |
zero. |
|
|
251 |
|
|
|
252 |
|
|
|
253 |
The higher this value, the more detail will be logged to the |
|
|
254 |
log files about the activities of the client. At level 0, |
|
|
255 |
only critical errors and serious warnings will be logged. |
|
|
256 |
Level 1 is a reasonable level for day to day running - it |
|
|
257 |
generates a small amount of information about operations |
|
|
258 |
carried out. |
|
|
259 |
|
|
|
260 |
|
|
|
261 |
Levels above 1 will generate considerable amounts of log |
|
|
262 |
data, and should only be used when investigating a problem. |
|
|
263 |
Levels above 3 are designed for use only by developers and |
|
|
264 |
generate HUGE amounts of log data, most of which is |
|
|
265 |
extremely cryptic. If ''debuglevel'' is set to the letter |
|
|
266 |
'A', then __all__ debug messages will be printed. This |
|
|
267 |
setting is for developers only (and people who __really__ |
|
|
268 |
want to know how the code works internally). |
|
|
269 |
|
|
|
270 |
|
|
|
271 |
Note that specifying this parameter here will override the |
|
|
272 |
log level parameter in the ''smb.conf (5)'' |
|
|
273 |
file. |
|
|
274 |
|
|
|
275 |
|
|
|
276 |
__-p port__ |
|
|
277 |
|
|
|
278 |
|
|
|
279 |
This number is the TCP port number that will be used when |
|
|
280 |
making connections to the server. The standard (well-known) |
|
|
281 |
TCP port number for an SMB/CIFS server is 139, which is the |
|
|
282 |
default. |
|
|
283 |
|
|
|
284 |
|
|
|
285 |
__-l logfilename__ |
|
|
286 |
|
|
|
287 |
|
|
|
288 |
If specified, ''logfilename'' specifies a base filename |
|
|
289 |
into which operational data from the running client will be |
|
|
290 |
logged. |
|
|
291 |
|
|
|
292 |
|
|
|
293 |
The default base name is specified at compile |
|
|
294 |
time. |
|
|
295 |
|
|
|
296 |
|
|
|
297 |
The base name is used to generate actual log file names. For |
|
|
298 |
example, if the name specified was |
|
|
299 |
log.client''. |
|
|
300 |
|
|
|
301 |
|
|
|
302 |
The log file generated is never removed by the |
|
|
303 |
client. |
|
|
304 |
|
|
|
305 |
|
|
|
306 |
__-h__ |
|
|
307 |
|
|
|
308 |
|
|
|
309 |
Print the usage message for the client. |
|
|
310 |
|
|
|
311 |
|
|
|
312 |
__-I IP-address__ |
|
|
313 |
|
|
|
314 |
|
|
|
315 |
''IP address'' is the address of the server to connect |
|
|
316 |
to. It should be specified in standard |
|
|
317 |
'' |
|
|
318 |
|
|
|
319 |
|
|
|
320 |
Normally the client would attempt to locate a named SMB/CIFS |
|
|
321 |
server by looking it up via the NetBIOS name resolution |
|
|
322 |
mechanism described above in the ''name resolve order'' |
|
|
323 |
parameter above. Using this parameter will force the client |
|
|
324 |
to assume that the server is on the machine with the |
|
|
325 |
specified IP address and the NetBIOS name component of the |
|
|
326 |
resource being connected to will be ignored. |
|
|
327 |
|
|
|
328 |
|
|
|
329 |
There is no default for this parameter. If not supplied, it |
|
|
330 |
will be determined automatically by the client as described |
|
|
331 |
above. |
|
|
332 |
|
|
|
333 |
|
|
|
334 |
__-E__ |
|
|
335 |
|
|
|
336 |
|
|
|
337 |
This parameter causes the client to write messages to the |
|
|
338 |
standard error stream (stderr) rather than to the standard |
|
|
339 |
output stream. |
|
|
340 |
|
|
|
341 |
|
|
|
342 |
By default, the client writes messages to standard output - |
|
|
343 |
typically the user's tty. |
|
|
344 |
|
|
|
345 |
|
|
|
346 |
__-U username[[%pass]__ |
|
|
347 |
|
|
|
348 |
|
|
|
349 |
Sets the SMB username or username and password. If %pass is |
|
|
350 |
not specified, The user will be prompted. The client will |
|
|
351 |
first check the __USER__ environment variable, then the |
|
|
352 |
__LOGNAME__ variable and if either exists, the string is |
|
|
353 |
uppercased. Anything in these variables following a '%' sign |
|
|
354 |
will be treated as the password. If these environment |
|
|
355 |
variables are not found, the username GUEST is |
|
|
356 |
used. |
|
|
357 |
|
|
|
358 |
|
|
|
359 |
If the password is not included in these environment |
|
|
360 |
variables (using the %pass syntax), __smbclient__ will |
|
|
361 |
look for a __PASSWD__ environment variable from which to |
|
|
362 |
read the password. |
|
|
363 |
|
|
|
364 |
|
|
|
365 |
A third option is to use a credentials file which contains |
|
|
366 |
the plaintext of the domain name, username and password. |
|
|
367 |
This option is mainly provided for scripts where the admin |
|
|
368 |
doesn't wish to pass the credentials on the command line or |
|
|
369 |
via environment variables. If this method is used, make |
|
|
370 |
certain that the permissions on the file restrict access |
|
|
371 |
from unwanted users. See the ''-A'' for more |
|
|
372 |
details. |
|
|
373 |
|
|
|
374 |
|
|
|
375 |
Be cautious about including passwords in scripts or in the |
|
|
376 |
__PASSWD__ environment variable. Also, on many systems |
|
|
377 |
the command line of a running process may be seen via the |
|
|
378 |
__ps__ command to be safe always allow __smbclient__ |
|
|
379 |
to prompt for a password and type it in |
|
|
380 |
directly. |
|
|
381 |
|
|
|
382 |
|
|
|
383 |
__-A filename__ |
|
|
384 |
|
|
|
385 |
|
|
|
386 |
This option allows you to specify a file from which to read |
|
|
387 |
the username, domain name, and password used in the |
|
|
388 |
connection. The format of the file is |
|
|
389 |
|
|
|
390 |
|
|
|
391 |
username = |
|
|
392 |
If the domain parameter is missing the current workgroup name is used instead. Make certain that the permissions on the file restrict access from unwanted users. |
|
|
393 |
|
|
|
394 |
|
|
|
395 |
__-L__ |
|
|
396 |
|
|
|
397 |
|
|
|
398 |
This option allows you to look at what services are |
|
|
399 |
available on a server. You use it as __smbclient -L |
|
|
400 |
host__ and a list should appear. The ''-I'' option may |
|
|
401 |
be useful if your NetBIOS names don't match your TCP/IP DNS |
|
|
402 |
host names or if you are trying to reach a host on another |
|
|
403 |
network. |
|
|
404 |
|
|
|
405 |
|
|
|
406 |
__-t terminal code__ |
|
|
407 |
|
|
|
408 |
|
|
|
409 |
This option tells __smbclient__ how to interpret |
|
|
410 |
filenames coming from the remote server. Usually Asian |
|
|
411 |
language multibyte UNIX implementations use different |
|
|
412 |
character sets than SMB/CIFS servers (__EUC__ instead of |
|
|
413 |
__SJIS__ for example). Setting this parameter will let |
|
|
414 |
__smbclient__ convert between the UNIX filenames and the |
|
|
415 |
SMB filenames correctly. This option has not been seriously |
|
|
416 |
tested and may have some problems. |
|
|
417 |
|
|
|
418 |
|
|
|
419 |
The terminal codes include CWsjis, CWeuc, CWjis7, CWjis8, |
|
|
420 |
CWjunet, CWhex, CWcap. This is not a complete list, check |
|
|
421 |
the Samba source code for the complete list. |
|
|
422 |
|
|
|
423 |
|
|
|
424 |
__-b buffersize__ |
|
|
425 |
|
|
|
426 |
|
|
|
427 |
This option changes the transmit/send buffer size when |
|
|
428 |
getting or putting a file from/to the server. The default is |
|
|
429 |
65520 bytes. Setting this value smaller (to 1200 bytes) has |
|
|
430 |
been observed to speed up file transfers to and from a Win9x |
|
|
431 |
server. |
|
|
432 |
|
|
|
433 |
|
|
|
434 |
__-W WORKGROUP__ |
|
|
435 |
|
|
|
436 |
|
|
|
437 |
Override the default workgroup (domain) specified in the |
|
|
438 |
workgroup parameter of the ''smb.conf'' file for this |
|
|
439 |
connection. This may be needed to connect to some |
|
|
440 |
servers. |
|
|
441 |
|
|
|
442 |
|
|
|
443 |
__-T tar options__ |
|
|
444 |
|
|
|
445 |
|
|
|
446 |
smbclient may be used to create __tar(1)__ compatible |
|
|
447 |
backups of all the files on an SMB/CIFS share. The secondary |
|
|
448 |
tar flags that can be given to this option are |
|
|
449 |
: |
|
|
450 |
|
|
|
451 |
|
|
|
452 |
''c'' - Create a tar file on UNIX. Must be followed by |
|
|
453 |
the name of a tar file, tape device or |
|
|
454 |
''x'' |
|
|
455 |
flag. |
|
|
456 |
|
|
|
457 |
|
|
|
458 |
''x'' - Extract (restore) a local tar file back to a |
|
|
459 |
share. Unless the -D option is given, the tar files will be |
|
|
460 |
restored from the top level of the share. Must be followed |
|
|
461 |
by the name of the tar file, device or |
|
|
462 |
''c'' flag. |
|
|
463 |
Restored files have their creation times (mtime) set to the |
|
|
464 |
date saved in the tar file. Directories currently do not get |
|
|
465 |
their creation dates restored properly. |
|
|
466 |
|
|
|
467 |
|
|
|
468 |
''I'' - Include files and directories. Is the default |
|
|
469 |
behavior when filenames are specified above. Causes tar |
|
|
470 |
files to be included in an extract or create (and therefore |
|
|
471 |
everything else to be excluded). See example below. Filename |
|
|
472 |
globbing works in one of two ways. See r below. |
|
|
473 |
|
|
|
474 |
|
|
|
475 |
''X'' - Exclude files and directories. Causes tar files |
|
|
476 |
to be excluded from an extract or create. See example below. |
|
|
477 |
Filename globbing works in one of two ways now. See ''r'' |
|
|
478 |
below. |
|
|
479 |
|
|
|
480 |
|
|
|
481 |
''b'' - Blocksize. Must be followed by a valid (greater |
|
|
482 |
than zero) blocksize. Causes tar file to be written out in |
|
|
483 |
blocksize*TBLOCK (usually 512 byte) blocks. |
|
|
484 |
|
|
|
485 |
|
|
|
486 |
''g'' - Incremental. Only back up files that have the |
|
|
487 |
archive bit set. Useful only with the ''c'' |
|
|
488 |
flag. |
|
|
489 |
|
|
|
490 |
|
|
|
491 |
''q'' - Quiet. Keeps tar from printing diagnostics as it |
|
|
492 |
works. This is the same as tarmode quiet. |
|
|
493 |
|
|
|
494 |
|
|
|
495 |
''r'' - Regular expression include or exclude. Uses |
|
|
496 |
regular expression matching for excluding or excluding files |
|
|
497 |
if compiled with HAVE_REGEX_H. However this mode can be very |
|
|
498 |
slow. If not compiled with HAVE_REGEX_H, does a limited |
|
|
499 |
wildcard match on '*' and '?'. |
|
|
500 |
|
|
|
501 |
|
|
|
502 |
''N'' - Newer than. Must be followed by the name of a |
|
|
503 |
file whose date is compared against files found on the share |
|
|
504 |
during a create. Only files newer than the file specified |
|
|
505 |
are backed up to the tar file. Useful only with the ''c'' |
|
|
506 |
flag. |
|
|
507 |
|
|
|
508 |
|
|
|
509 |
''a'' - Set archive bit. Causes the archive bit to be |
|
|
510 |
reset when a file is backed up. Useful with the ''g'' and |
|
|
511 |
''c'' flags. |
|
|
512 |
|
|
|
513 |
|
|
|
514 |
__Tar Long File Names__ |
|
|
515 |
|
|
|
516 |
|
|
|
517 |
__smbclient__'s tar option now supports long file names |
|
|
518 |
both on backup and restore. However, the full path name of |
|
|
519 |
the file must be less than 1024 bytes. Also, when a tar |
|
|
520 |
archive is created, __smbclient__'s tar option places all |
|
|
521 |
files in the archive with relative names, not absolute |
|
|
522 |
names. |
|
|
523 |
|
|
|
524 |
|
|
|
525 |
__Tar Filenames__ |
|
|
526 |
|
|
|
527 |
|
|
|
528 |
All file names can be given as DOS path names (with '' as |
|
|
529 |
the component separator) or as UNIX path names (with '/' as |
|
|
530 |
the component separator). |
|
|
531 |
|
|
|
532 |
|
|
|
533 |
__Examples__ |
|
|
534 |
|
|
|
535 |
|
|
|
536 |
Restore from tar file ''backup.tar'' into myshare on mypc |
|
|
537 |
(no password on share). |
|
|
538 |
|
|
|
539 |
|
|
|
540 |
__smbclient //mypc/yshare |
|
|
541 |
__ |
|
|
542 |
|
|
|
543 |
|
|
|
544 |
Restore everything except ''users/docs'' |
|
|
545 |
|
|
|
546 |
|
|
|
547 |
__smbclient //mypc/myshare |
|
|
548 |
__ |
|
|
549 |
|
|
|
550 |
|
|
|
551 |
Create a tar file of the files beneath |
|
|
552 |
''users/docs''. |
|
|
553 |
|
|
|
554 |
|
|
|
555 |
__smbclient //mypc/myshare |
|
|
556 |
__ |
|
|
557 |
|
|
|
558 |
|
|
|
559 |
Create the same tar file as above, but now use a DOS path |
|
|
560 |
name. |
|
|
561 |
|
|
|
562 |
|
|
|
563 |
__smbclient //mypc/myshare |
|
|
564 |
__ |
|
|
565 |
|
|
|
566 |
|
|
|
567 |
Create a tar file of all the files and directories in the |
|
|
568 |
share. |
|
|
569 |
|
|
|
570 |
|
|
|
571 |
__smbclient //mypc/myshare |
|
|
572 |
__ |
|
|
573 |
|
|
|
574 |
|
|
|
575 |
__-D initial directory__ |
|
|
576 |
|
|
|
577 |
|
|
|
578 |
Change to initial directory before starting. Probably only |
|
|
579 |
of any use with the tar -T option. |
|
|
580 |
|
|
|
581 |
|
|
|
582 |
__-c command string__ |
|
|
583 |
|
|
|
584 |
|
|
|
585 |
command string is a semicolon-separated list of commands to |
|
|
586 |
be executed instead of prompting from stdin. ''-N'' is |
|
|
587 |
implied by ''-c''. |
|
|
588 |
|
|
|
589 |
|
|
|
590 |
This is particularly useful in scripts and for printing |
|
|
591 |
stdin to the server, e.g. __-c 'print -'__. |
|
|
592 |
!!OPERATIONS |
|
|
593 |
|
|
|
594 |
|
|
|
595 |
Once the client is running, the user is presented with a |
|
|
596 |
prompt : |
|
|
597 |
|
|
|
598 |
|
|
|
599 |
smb: |
|
|
600 |
|
|
|
601 |
|
|
|
602 |
The backslash ( |
|
|
603 |
|
|
|
604 |
|
|
|
605 |
The prompt indicates that the client is ready and waiting to |
|
|
606 |
carry out a user command. Each command is a single word, |
|
|
607 |
optionally followed by parameters specific to that command. |
|
|
608 |
Command and parameters are space-delimited unless these |
|
|
609 |
notes specifically state otherwise. All commands are |
|
|
610 |
case-insensitive. Parameters to commands may or may not be |
|
|
611 |
case sensitive, depending on the command. |
|
|
612 |
|
|
|
613 |
|
|
|
614 |
You can specify file names which have spaces in them by |
|
|
615 |
quoting the name with double quotes, for example |
|
|
616 |
|
|
|
617 |
|
|
|
618 |
Parameters shown in square brackets (e.g., |
|
|
619 |
|
|
|
620 |
|
|
|
621 |
Note that all commands operating on the server are actually |
|
|
622 |
performed by issuing a request to the server. Thus the |
|
|
623 |
behavior may vary from server to server, depending on how |
|
|
624 |
the server was implemented. |
|
|
625 |
|
|
|
626 |
|
|
|
627 |
The commands available are given here in alphabetical |
|
|
628 |
order. |
|
|
629 |
|
|
|
630 |
|
|
|
631 |
__? [[command]__ |
|
|
632 |
|
|
|
633 |
|
|
|
634 |
If ''command'' is specified, the ? command will display a |
|
|
635 |
brief informative message about the specified command. If no |
|
|
636 |
command is specified, a list of available commands will be |
|
|
637 |
displayed. |
|
|
638 |
|
|
|
639 |
|
|
|
640 |
__! [[shell command]__ |
|
|
641 |
|
|
|
642 |
|
|
|
643 |
If ''shell command'' is specified, the ! command will |
|
|
644 |
execute a shell locally and run the specified shell command. |
|
|
645 |
If no command is specified, a local shell will be |
|
|
646 |
run. |
|
|
647 |
|
|
|
648 |
|
|
|
649 |
__altname file__ |
|
|
650 |
|
|
|
651 |
|
|
|
652 |
The client will request that the server return the |
|
|
653 |
|
|
|
654 |
|
|
|
655 |
__cancel jobid0 [[jobid1] ... [[jobidN]__ |
|
|
656 |
|
|
|
657 |
|
|
|
658 |
The client will request that the server cancel the printjobs |
|
|
659 |
identified by the given numeric print job ids. |
|
|
660 |
|
|
|
661 |
|
|
|
662 |
__chmod file mode in octal__ |
|
|
663 |
|
|
|
664 |
|
|
|
665 |
This command depends on the server supporting the CIFS UNIX |
|
|
666 |
extensions and will fail if the server does not. The client |
|
|
667 |
requests that the server change the UNIX permissions to the |
|
|
668 |
given octal mode, in standard UNIX format. |
|
|
669 |
|
|
|
670 |
|
|
|
671 |
__chown file uid gid__ |
|
|
672 |
|
|
|
673 |
|
|
|
674 |
This command depends on the server supporting the CIFS UNIX |
|
|
675 |
extensions and will fail if the server does not. The client |
|
|
676 |
requests that the server change the UNIX user and group |
|
|
677 |
ownership to the given decimal values. Note there is |
|
|
678 |
currently no way to remotely look up the UNIX uid and gid |
|
|
679 |
values for a given name. This may be addressed in future |
|
|
680 |
versions of the CIFS UNIX extensions. |
|
|
681 |
|
|
|
682 |
|
|
|
683 |
__cd [[directory name]__ |
|
|
684 |
|
|
|
685 |
|
|
|
686 |
If |
|
|
687 |
|
|
|
688 |
|
|
|
689 |
If no directory name is specified, the current working |
|
|
690 |
directory on the server will be reported. |
|
|
691 |
|
|
|
692 |
|
|
|
693 |
__del __ |
|
|
694 |
|
|
|
695 |
|
|
|
696 |
The client will request that the server attempt to delete |
|
|
697 |
all files matching ''mask'' from the current working |
|
|
698 |
directory on the server. |
|
|
699 |
|
|
|
700 |
|
|
|
701 |
__dir __ |
|
|
702 |
|
|
|
703 |
|
|
|
704 |
A list of the files matching ''mask'' in the current |
|
|
705 |
working directory on the server will be retrieved from the |
|
|
706 |
server and displayed. |
|
|
707 |
|
|
|
708 |
|
|
|
709 |
__exit__ |
|
|
710 |
|
|
|
711 |
|
|
|
712 |
Terminate the connection with the server and exit from the |
|
|
713 |
program. |
|
|
714 |
|
|
|
715 |
|
|
|
716 |
__get |
|
|
717 |
__ |
|
|
718 |
|
|
|
719 |
|
|
|
720 |
Copy the file called ''remote file name'' from the server |
|
|
721 |
to the machine running the client. If specified, name the |
|
|
722 |
local copy ''local file name''. Note that all transfers |
|
|
723 |
in __smbclient__ are binary. See also the lowercase |
|
|
724 |
command. |
|
|
725 |
|
|
|
726 |
|
|
|
727 |
__help [[command]__ |
|
|
728 |
|
|
|
729 |
|
|
|
730 |
See the ? command above. |
|
|
731 |
|
|
|
732 |
|
|
|
733 |
__lcd [[directory name]__ |
|
|
734 |
|
|
|
735 |
|
|
|
736 |
If ''directory name'' is specified, the current working |
|
|
737 |
directory on the local machine will be changed to the |
|
|
738 |
directory specified. This operation will fail if for any |
|
|
739 |
reason the specified directory is inaccessible. |
|
|
740 |
|
|
|
741 |
|
|
|
742 |
If no directory name is specified, the name of the current |
|
|
743 |
working directory on the local machine will be |
|
|
744 |
reported. |
|
|
745 |
|
|
|
746 |
|
|
|
747 |
__link source destination__ |
|
|
748 |
|
|
|
749 |
|
|
|
750 |
This command depends on the server supporting the CIFS UNIX |
|
|
751 |
extensions and will fail if the server does not. The client |
|
|
752 |
requests that the server create a hard link between the |
|
|
753 |
source and destination files. The source file must not |
|
|
754 |
exist. |
|
|
755 |
|
|
|
756 |
|
|
|
757 |
__lowercase__ |
|
|
758 |
|
|
|
759 |
|
|
|
760 |
Toggle lowercasing of filenames for the get and mget |
|
|
761 |
commands. |
|
|
762 |
|
|
|
763 |
|
|
|
764 |
When lowercasing is toggled ON, local filenames are |
|
|
765 |
converted to lowercase when using the get and mget commands. |
|
|
766 |
This is often useful when copying (say) MSDOS files from a |
|
|
767 |
server, because lowercase filenames are the norm on UNIX |
|
|
768 |
systems. |
|
|
769 |
|
|
|
770 |
|
|
|
771 |
__ls __ |
|
|
772 |
|
|
|
773 |
|
|
|
774 |
See the dir command above. |
|
|
775 |
|
|
|
776 |
|
|
|
777 |
__mask __ |
|
|
778 |
|
|
|
779 |
|
|
|
780 |
This command allows the user to set up a mask which will be |
|
|
781 |
used during recursive operation of the mget and mput |
|
|
782 |
commands. |
|
|
783 |
|
|
|
784 |
|
|
|
785 |
The masks specified to the mget and mput commands act as |
|
|
786 |
filters for directories rather than files when recursion is |
|
|
787 |
toggled ON. |
|
|
788 |
|
|
|
789 |
|
|
|
790 |
The mask specified with the mask command is necessary to |
|
|
791 |
filter files within those directories. For example, if the |
|
|
792 |
mask specified in an mget command is |
|
|
793 |
|
|
|
794 |
|
|
|
795 |
Note that the value for mask defaults to blank (equivalent |
|
|
796 |
to |
|
|
797 |
|
|
|
798 |
|
|
|
799 |
__md __ |
|
|
800 |
|
|
|
801 |
|
|
|
802 |
See the mkdir command. |
|
|
803 |
|
|
|
804 |
|
|
|
805 |
__mget __ |
|
|
806 |
|
|
|
807 |
|
|
|
808 |
Copy all files matching ''mask'' from the server to the |
|
|
809 |
machine running the client. |
|
|
810 |
|
|
|
811 |
|
|
|
812 |
Note that ''mask'' is interpreted differently during |
|
|
813 |
recursive operation and non-recursive operation - refer to |
|
|
814 |
the recurse and mask commands for more information. Note |
|
|
815 |
that all transfers in __smbclient__ are binary. See also |
|
|
816 |
the lowercase command. |
|
|
817 |
|
|
|
818 |
|
|
|
819 |
__mkdir __ |
|
|
820 |
|
|
|
821 |
|
|
|
822 |
Create a new directory on the server (user access privileges |
|
|
823 |
permitting) with the specified name. |
|
|
824 |
|
|
|
825 |
|
|
|
826 |
__mput __ |
|
|
827 |
|
|
|
828 |
|
|
|
829 |
Copy all files matching ''mask'' in the current working |
|
|
830 |
directory on the local machine to the current working |
|
|
831 |
directory on the server. |
|
|
832 |
|
|
|
833 |
|
|
|
834 |
Note that ''mask'' is interpreted differently during |
|
|
835 |
recursive operation and non-recursive operation - refer to |
|
|
836 |
the recurse and mask commands for more information. Note |
|
|
837 |
that all transfers in __smbclient__ are |
|
|
838 |
binary. |
|
|
839 |
|
|
|
840 |
|
|
|
841 |
__print __ |
|
|
842 |
|
|
|
843 |
|
|
|
844 |
Print the specified file from the local machine through a |
|
|
845 |
printable service on the server. |
|
|
846 |
|
|
|
847 |
|
|
|
848 |
See also the printmode command. |
|
|
849 |
|
|
|
850 |
|
|
|
851 |
__printmode __ |
|
|
852 |
|
|
|
853 |
|
|
|
854 |
Set the print mode to suit either binary data (such as |
|
|
855 |
graphical information) or text. Subsequent print commands |
|
|
856 |
will use the currently set print mode. |
|
|
857 |
|
|
|
858 |
|
|
|
859 |
__prompt__ |
|
|
860 |
|
|
|
861 |
|
|
|
862 |
Toggle prompting for filenames during operation of the mget |
|
|
863 |
and mput commands. |
|
|
864 |
|
|
|
865 |
|
|
|
866 |
When toggled ON, the user will be prompted to confirm the |
|
|
867 |
transfer of each file during these commands. When toggled |
|
|
868 |
OFF, all specified files will be transferred without |
|
|
869 |
prompting. |
|
|
870 |
|
|
|
871 |
|
|
|
872 |
__put |
|
|
873 |
__ |
|
|
874 |
|
|
|
875 |
|
|
|
876 |
Copy the file called ''local file name'' from the machine |
|
|
877 |
running the client to the server. If specified, name the |
|
|
878 |
remote copy ''remote file name''. Note that all transfers |
|
|
879 |
in __smbclient__ are binary. See also the lowercase |
|
|
880 |
command. |
|
|
881 |
|
|
|
882 |
|
|
|
883 |
__queue__ |
|
|
884 |
|
|
|
885 |
|
|
|
886 |
Displays the print queue, showing the job id, name, size and |
|
|
887 |
current status. |
|
|
888 |
|
|
|
889 |
|
|
|
890 |
__quit__ |
|
|
891 |
|
|
|
892 |
|
|
|
893 |
See the exit command. |
|
|
894 |
|
|
|
895 |
|
|
|
896 |
__rd __ |
|
|
897 |
|
|
|
898 |
|
|
|
899 |
See the rmdir command. |
|
|
900 |
|
|
|
901 |
|
|
|
902 |
__recurse__ |
|
|
903 |
|
|
|
904 |
|
|
|
905 |
Toggle directory recursion for the commands mget and |
|
|
906 |
mput. |
|
|
907 |
|
|
|
908 |
|
|
|
909 |
When toggled ON, these commands will process all directories |
|
|
910 |
in the source directory (i.e., the directory they are |
|
|
911 |
copying from ) and will recurse into any that match the mask |
|
|
912 |
specified to the command. Only files that match the mask |
|
|
913 |
specified using the mask command will be retrieved. See also |
|
|
914 |
the mask command. |
|
|
915 |
|
|
|
916 |
|
|
|
917 |
When recursion is toggled OFF, only files from the current |
|
|
918 |
working directory on the source machine that match the mask |
|
|
919 |
specified to the mget or mput commands will be copied, and |
|
|
920 |
any mask specified using the mask command will be |
|
|
921 |
ignored. |
|
|
922 |
|
|
|
923 |
|
|
|
924 |
__rm __ |
|
|
925 |
|
|
|
926 |
|
|
|
927 |
Remove all files matching ''mask'' from the current |
|
|
928 |
working directory on the server. |
|
|
929 |
|
|
|
930 |
|
|
|
931 |
__rmdir __ |
|
|
932 |
|
|
|
933 |
|
|
|
934 |
Remove the specified directory (user access privileges |
|
|
935 |
permitting) from the server. |
|
|
936 |
|
|
|
937 |
|
|
|
938 |
__setmode |
|
|
939 |
__ |
|
|
940 |
|
|
|
941 |
|
|
|
942 |
A version of the DOS attrib command to set file permissions. |
|
|
943 |
For example: |
|
|
944 |
|
|
|
945 |
|
|
|
946 |
__setmode myfile +r__ |
|
|
947 |
|
|
|
948 |
|
|
|
949 |
would make myfile read only. |
|
|
950 |
|
|
|
951 |
|
|
|
952 |
__symlink source destination__ |
|
|
953 |
|
|
|
954 |
|
|
|
955 |
This command depends on the server supporting the CIFS UNIX |
|
|
956 |
extensions and will fail if the server does not. The client |
|
|
957 |
requests that the server create a symbolic hard link between |
|
|
958 |
the source and destination files. The source file must not |
|
|
959 |
exist. Note that the server will not create a link to any |
|
|
960 |
path that lies outside the currently connected share. This |
|
|
961 |
is enforced by the Samba server. |
|
|
962 |
|
|
|
963 |
|
|
|
964 |
__tar __ |
|
|
965 |
|
|
|
966 |
|
|
|
967 |
Performs a tar operation - see the ''-T'' command line |
|
|
968 |
option above. Behavior may be affected by the tarmode |
|
|
969 |
command (see below). Using g (incremental) and N (newer) |
|
|
970 |
will affect tarmode settings. Note that using the |
|
|
971 |
'' |
|
|
972 |
|
|
|
973 |
|
|
|
974 |
__blocksize __ |
|
|
975 |
|
|
|
976 |
|
|
|
977 |
Blocksize. Must be followed by a valid (greater than zero) |
|
|
978 |
blocksize. Causes tar file to be written out in |
|
|
979 |
''blocksize''*TBLOCK (usually 512 byte) |
|
|
980 |
blocks. |
|
|
981 |
|
|
|
982 |
|
|
|
983 |
__tarmode __ |
|
|
984 |
|
|
|
985 |
|
|
|
986 |
Changes tar's behavior with regard to archive bits. In full |
|
|
987 |
mode, tar will back up everything regardless of the archive |
|
|
988 |
bit setting (this is the default mode). In incremental mode, |
|
|
989 |
tar will only back up files with the archive bit set. In |
|
|
990 |
reset mode, tar will reset the archive bit on all files it |
|
|
991 |
backs up (implies read/write share). |
|
|
992 |
!!NOTES |
|
|
993 |
|
|
|
994 |
|
|
|
995 |
Some servers are fussy about the case of supplied usernames, |
|
|
996 |
passwords, share names (AKA service names) and machine |
|
|
997 |
names. If you fail to connect try giving all parameters in |
|
|
998 |
uppercase. |
|
|
999 |
|
|
|
1000 |
|
|
|
1001 |
It is often necessary to use the -n option when connecting |
2 |
perry |
1002 |
to some types of servers. For example OS/2 !LanManager |
1 |
perry |
1003 |
insists on a valid NetBIOS name being used, so you need to |
|
|
1004 |
supply a valid name that would be known to the |
|
|
1005 |
server. |
|
|
1006 |
|
|
|
1007 |
|
|
|
1008 |
smbclient supports long file names where the server supports |
|
|
1009 |
the LANMAN2 protocol or above. |
|
|
1010 |
!!ENVIRONMENT VARIABLES |
|
|
1011 |
|
|
|
1012 |
|
|
|
1013 |
The variable __USER__ may contain the username of the |
|
|
1014 |
person using the client. This information is used only if |
|
|
1015 |
the protocol level is high enough to support session-level |
|
|
1016 |
passwords. |
|
|
1017 |
|
|
|
1018 |
|
|
|
1019 |
The variable __PASSWD__ may contain the password of the |
|
|
1020 |
person using the client. This information is used only if |
|
|
1021 |
the protocol level is high enough to support session-level |
|
|
1022 |
passwords. |
|
|
1023 |
|
|
|
1024 |
|
|
|
1025 |
The variable __LIBSMB_PROG__ may contain the path, |
|
|
1026 |
executed with system(), which the client should connect to |
|
|
1027 |
instead of connecting to a server. This functionality is |
|
|
1028 |
primarily intended as a development aid, and works best when |
|
|
1029 |
using a LMHOSTS file |
|
|
1030 |
!!INSTALLATION |
|
|
1031 |
|
|
|
1032 |
|
|
|
1033 |
The location of the client program is a matter for |
|
|
1034 |
individual system administrators. The following are thus |
|
|
1035 |
suggestions only. |
|
|
1036 |
|
|
|
1037 |
|
|
|
1038 |
It is recommended that the smbclient software be installed |
|
|
1039 |
in the ''/usr/local/samba/bin/'' or |
|
|
1040 |
''/usr/samba/bin/'' directory, this directory readable by |
|
|
1041 |
all, writeable only by root. The client program itself |
|
|
1042 |
should be executable by all. The client should __NOT__ be |
|
|
1043 |
setuid or setgid! |
|
|
1044 |
|
|
|
1045 |
|
|
|
1046 |
The client log files should be put in a directory readable |
|
|
1047 |
and writeable only by the user. |
|
|
1048 |
|
|
|
1049 |
|
|
|
1050 |
To test the client, you will need to know the name of a |
|
|
1051 |
running SMB/CIFS server. It is possible to run |
|
|
1052 |
__smbd(8)__ as an ordinary user - running that server as |
|
|
1053 |
a daemon on a user-accessible port (typically any port |
|
|
1054 |
number over 1024) would provide a suitable test |
|
|
1055 |
server. |
|
|
1056 |
!!DIAGNOSTICS |
|
|
1057 |
|
|
|
1058 |
|
|
|
1059 |
Most diagnostics issued by the client are logged in a |
|
|
1060 |
specified log file. The log file name is specified at |
|
|
1061 |
compile time, but may be overridden on the command |
|
|
1062 |
line. |
|
|
1063 |
|
|
|
1064 |
|
|
|
1065 |
The number and nature of diagnostics available depends on |
|
|
1066 |
the debug level used by the client. If you have problems, |
|
|
1067 |
set the debug level to 3 and peruse the log |
|
|
1068 |
files. |
|
|
1069 |
!!VERSION |
|
|
1070 |
|
|
|
1071 |
|
|
|
1072 |
This man page is correct for version 2.2 of the Samba |
|
|
1073 |
suite. |
|
|
1074 |
!!AUTHOR |
|
|
1075 |
|
|
|
1076 |
|
|
|
1077 |
The original Samba software and related utilities were |
|
|
1078 |
created by Andrew Tridgell. Samba is now developed by the |
|
|
1079 |
Samba Team as an Open Source project similar to the way the |
|
|
1080 |
Linux kernel is developed. |
|
|
1081 |
|
|
|
1082 |
|
|
|
1083 |
The original Samba man pages were written by Karl Auer. The |
|
|
1084 |
man page sources were converted to YODL format (another |
|
|
1085 |
excellent piece of Open Source software, available at |
|
|
1086 |
ftp://ftp.icce.rug.nl/pub/unix/ |
|
|
1087 |
---- |