1SMBCLIENT(1) User Commands SMBCLIENT(1)
2
3
4
6 smbclient - ftp-like client to access SMB/CIFS resources on servers
7
9 smbclient [-b <buffer size>] [-d debuglevel] [-e] [-L <netbios name>]
10 [-U username] [-I destinationIP] [-M <netbios name>] [-m maxprotocol]
11 [-A authfile] [-N] [-C] [-g] [-i scope] [-O <socket options>]
12 [-p port] [-R <name resolve order>] [-s <smb config file>]
13 [-t <per-operation timeout in seconds>] [-k] [-P] [-c <command>]
14
15 smbclient {servicename} [password] [-b <buffer size>] [-d debuglevel]
16 [-e] [-D Directory] [-U username] [-W workgroup] [-M <netbios name>]
17 [-m maxprotocol] [-A authfile] [-N] [-C] [-g] [-l log-basename]
18 [-I destinationIP] [-E] [-c <command string>] [-i scope]
19 [-O <socket options>] [-p port] [-R <name resolve order>]
20 [-s <smb config file>] [-t <per-operation timeout in seconds>]
21 [-T<c|x>IXFqgbNan] [-k]
22
24 This tool is part of the samba(7) suite.
25
26 smbclient is a client that can ´talk´ to an SMB/CIFS server. It offers
27 an interface similar to that of the ftp program (see ftp(1)).
28 Operations include things like getting files from the server to the
29 local machine, putting files from the local machine to the server,
30 retrieving directory information from the server and so on.
31
33 servicename
34 servicename is the name of the service you want to use on the
35 server. A service name takes the form //server/service where server
36 is the NetBIOS name of the SMB/CIFS server offering the desired
37 service and service is the name of the service offered. Thus to
38 connect to the service "printer" on the SMB/CIFS server
39 "smbserver", you would use the servicename //smbserver/printer
40
41 Note that the server name required is NOT necessarily the IP (DNS)
42 host name of the server ! The name required is a NetBIOS server
43 name, which may or may not be the same as the IP hostname of the
44 machine running the server.
45
46 The server name is looked up according to either the -R parameter
47 to smbclient or using the name resolve order parameter in the
48 smb.conf(5) file, allowing an administrator to change the order and
49 methods by which server names are looked up.
50
51 password
52 The password required to access the specified service on the
53 specified server. If this parameter is supplied, the -N option
54 (suppress password prompt) is assumed.
55
56 There is no default password. If no password is supplied on the
57 command line (either by using this parameter or adding a password
58 to the -U option (see below)) and the -N option is not specified,
59 the client will prompt for a password, even if the desired service
60 does not require one. (If no password is required, simply press
61 ENTER to provide a null password.)
62
63 Note: Some servers (including OS/2 and Windows for Workgroups)
64 insist on an uppercase password. Lowercase or mixed case passwords
65 may be rejected by these servers.
66
67 Be cautious about including passwords in scripts.
68
69 -R|--name-resolve <name resolve order>
70 This option is used by the programs in the Samba suite to determine
71 what naming services and in what order to resolve host names to IP
72 addresses. The option takes a space-separated string of different
73 name resolution options.
74
75 The options are :"lmhosts", "host", "wins" and "bcast". They cause
76 names to be resolved as follows:
77
78 · lmhosts: Lookup an IP address in the Samba lmhosts file. If the
79 line in lmhosts has no name type attached to the NetBIOS name
80 (see the lmhosts(5) for details) then any name type matches for
81 lookup.
82
83 · host: Do a standard host name to IP address resolution, using
84 the system /etc/hosts, NIS, or DNS lookups. This method of name
85 resolution is operating system dependent, for instance on IRIX
86 or Solaris this may be controlled by the /etc/nsswitch.conf
87 file). Note that this method is only used if the NetBIOS name
88 type being queried is the 0x20 (server) name type, otherwise it
89 is ignored.
90
91 · wins: Query a name with the IP address listed in the wins
92 server parameter. If no WINS server has been specified this
93 method will be ignored.
94
95 · bcast: Do a broadcast on each of the known local interfaces
96 listed in the interfaces parameter. This is the least reliable
97 of the name resolution methods as it depends on the target host
98 being on a locally connected subnet.
99
100 If this parameter is not set then the name resolve order defined in the
101 smb.conf(5) file parameter (name resolve order) will be used.
102
103 The default order is lmhosts, host, wins, bcast and without this
104 parameter or any entry in the name resolve order parameter of the
105 smb.conf(5) file the name resolution methods will be attempted in this
106 order.
107
108 -M|--message NetBIOS name
109 This options allows you to send messages, using the "WinPopup"
110 protocol, to another computer. Once a connection is established you
111 then type your message, pressing ^D (control-D) to end.
112
113 If the receiving computer is running WinPopup the user will receive
114 the message and probably a beep. If they are not running WinPopup
115 the message will be lost, and no error message will occur.
116
117 The message is also automatically truncated if the message is over
118 1600 bytes, as this is the limit of the protocol.
119
120 One useful trick is to pipe the message through smbclient. For
121 example: smbclient -M FRED < mymessage.txt will send the message in
122 the file mymessage.txt to the machine FRED.
123
124 You may also find the -U and -I options useful, as they allow you
125 to control the FROM and TO parts of the message.
126
127 See the message command parameter in the smb.conf(5) for a
128 description of how to handle incoming WinPopup messages in Samba.
129
130 Note: Copy WinPopup into the startup group on your WfWg PCs if you
131 want them to always be able to receive messages.
132
133 -p|--port port
134 This number is the TCP port number that will be used when making
135 connections to the server. The standard (well-known) TCP port
136 number for an SMB/CIFS server is 139, which is the default.
137
138 -g|--grepable
139 This parameter provides combined with -L easy parseable output that
140 allows processing with utilities such as grep and cut.
141
142 -m|--max-protocol protocol
143 This allows the user to select the highest SMB protocol level that
144 smbclient will use to connect to the server. By default this is set
145 to NT1, which is the highest available SMB1 protocol. To connect
146 using SMB2 or SMB3 protocol, use the strings SMB2 or SMB3
147 respectively. Note that to connect to a Windows 2012 server with
148 encrypted transport selecting a max-protocol of SMB3 is required.
149
150 -P|--machine-pass
151 Make queries to the external server using the machine account of
152 the local server.
153
154 -I|--ip-address IP-address
155 IP address is the address of the server to connect to. It should be
156 specified in standard "a.b.c.d" notation.
157
158 Normally the client would attempt to locate a named SMB/CIFS server
159 by looking it up via the NetBIOS name resolution mechanism
160 described above in the name resolve order parameter above. Using
161 this parameter will force the client to assume that the server is
162 on the machine with the specified IP address and the NetBIOS name
163 component of the resource being connected to will be ignored.
164
165 There is no default for this parameter. If not supplied, it will be
166 determined automatically by the client as described above.
167
168 -E|--stderr
169 This parameter causes the client to write messages to the standard
170 error stream (stderr) rather than to the standard output stream.
171
172 By default, the client writes messages to standard output -
173 typically the user´s tty.
174
175 -L|--list
176 This option allows you to look at what services are available on a
177 server. You use it as smbclient -L host and a list should appear.
178 The -I option may be useful if your NetBIOS names don´t match your
179 TCP/IP DNS host names or if you are trying to reach a host on
180 another network.
181
182 -b|--send-buffer buffersize
183 When sending or receiving files, smbclient uses an internal buffer
184 sized by the maximum number of allowed requests to the connected
185 server. This command allows this size to be set to any range
186 between 0 (which means use the default server controlled size)
187 bytes and 16776960 (0xFFFF00) bytes. Using the server controlled
188 size is the most efficient as smbclient will pipeline as many
189 simultaneous reads or writes needed to keep the server as busy as
190 possible. Setting this to any other size will slow down the
191 transfer. This can also be set using the iosize command inside
192 smbclient.
193
194 -B|--browse
195 Browse SMB servers using DNS.
196
197 -d|--debuglevel=level
198 level is an integer from 0 to 10. The default value if this
199 parameter is not specified is 1.
200
201 The higher this value, the more detail will be logged to the log
202 files about the activities of the server. At level 0, only critical
203 errors and serious warnings will be logged. Level 1 is a reasonable
204 level for day-to-day running - it generates a small amount of
205 information about operations carried out.
206
207 Levels above 1 will generate considerable amounts of log data, and
208 should only be used when investigating a problem. Levels above 3
209 are designed for use only by developers and generate HUGE amounts
210 of log data, most of which is extremely cryptic.
211
212 Note that specifying this parameter here will override the log
213 level parameter in the smb.conf file.
214
215 -V|--version
216 Prints the program version number.
217
218 -s|--configfile=<configuration file>
219 The file specified contains the configuration details required by
220 the server. The information in this file includes server-specific
221 information such as what printcap file to use, as well as
222 descriptions of all the services that the server is to provide. See
223 smb.conf for more information. The default configuration file name
224 is determined at compile time.
225
226 -l|--log-basename=logdirectory
227 Base directory name for log/debug files. The extension ".progname"
228 will be appended (e.g. log.smbclient, log.smbd, etc...). The log
229 file is never removed by the client.
230
231 --option=<name>=<value>
232 Set the smb.conf(5) option "<name>" to value "<value>" from the
233 command line. This overrides compiled-in defaults and options read
234 from the configuration file.
235
236 -N|--no-pass
237 If specified, this parameter suppresses the normal password prompt
238 from the client to the user. This is useful when accessing a
239 service that does not require a password.
240
241 Unless a password is specified on the command line or this
242 parameter is specified, the client will request a password.
243
244 If a password is specified on the command line and this option is
245 also defined the password on the command line will be silently
246 ingnored and no password will be used.
247
248 -k|--kerberos
249 Try to authenticate with kerberos. Only useful in an Active
250 Directory environment.
251
252 -C|--use-ccache
253 Try to use the credentials cached by winbind.
254
255 -A|--authentication-file=filename
256 This option allows you to specify a file from which to read the
257 username and password used in the connection. The format of the
258 file is
259
260 username = <value>
261 password = <value>
262 domain = <value>
263
264 Make certain that the permissions on the file restrict access from
265 unwanted users.
266
267 -U|--user=username[%password]
268 Sets the SMB username or username and password.
269
270 If %password is not specified, the user will be prompted. The
271 client will first check the USER environment variable, then the
272 LOGNAME variable and if either exists, the string is uppercased. If
273 these environmental variables are not found, the username GUEST is
274 used.
275
276 A third option is to use a credentials file which contains the
277 plaintext of the username and password. This option is mainly
278 provided for scripts where the admin does not wish to pass the
279 credentials on the command line or via environment variables. If
280 this method is used, make certain that the permissions on the file
281 restrict access from unwanted users. See the -A for more details.
282
283 Be cautious about including passwords in scripts. Also, on many
284 systems the command line of a running process may be seen via the
285 ps command. To be safe always allow rpcclient to prompt for a
286 password and type it in directly.
287
288 -S|--signing on|off|required
289 Set the client signing state.
290
291 -P|--machine-pass
292 Use stored machine account password.
293
294 -e|--encrypt
295 This command line parameter requires the remote server support the
296 UNIX extensions or that the SMB3 protocol has been selected.
297 Requests that the connection be encrypted. Negotiates SMB
298 encryption using either SMB3 or POSIX extensions via GSSAPI. Uses
299 the given credentials for the encryption negotiation (either
300 kerberos or NTLMv1/v2 if given domain/username/password triple.
301 Fails the connection if encryption cannot be negotiated.
302
303 --pw-nt-hash
304 The supplied password is the NT hash.
305
306 -n|--netbiosname <primary NetBIOS name>
307 This option allows you to override the NetBIOS name that Samba uses
308 for itself. This is identical to setting the netbios name parameter
309 in the smb.conf file. However, a command line setting will take
310 precedence over settings in smb.conf.
311
312 -i|--scope <scope>
313 This specifies a NetBIOS scope that nmblookup will use to
314 communicate with when generating NetBIOS names. For details on the
315 use of NetBIOS scopes, see rfc1001.txt and rfc1002.txt. NetBIOS
316 scopes are very rarely used, only set this parameter if you are the
317 system administrator in charge of all the NetBIOS systems you
318 communicate with.
319
320 -W|--workgroup=domain
321 Set the SMB domain of the username. This overrides the default
322 domain which is the domain defined in smb.conf. If the domain
323 specified is the same as the servers NetBIOS name, it causes the
324 client to log on using the servers local SAM (as opposed to the
325 Domain SAM).
326
327 -O|--socket-options socket options
328 TCP socket options to set on the client socket. See the socket
329 options parameter in the smb.conf manual page for the list of valid
330 options.
331
332 -?|--help
333 Print a summary of command line options.
334
335 --usage
336 Display brief usage message.
337
338 -t|--timeout <timeout-seconds>
339 This allows the user to tune the default timeout used for each SMB
340 request. The default setting is 20 seconds. Increase it if requests
341 to the server sometimes time out. This can happen when SMB3
342 encryption is selected and smbclient is overwhelming the server
343 with requests. This can also be set using the timeout command
344 inside smbclient.
345
346 -T|--tar tar options
347 smbclient may be used to create tar(1) compatible backups of all
348 the files on an SMB/CIFS share. The secondary tar flags that can be
349 given to this option are:
350
351 · c - Create a tar backup archive on the local system. Must be
352 followed by the name of a tar file, tape device or "-" for
353 standard output. If using standard output you must turn the log
354 level to its lowest value -d0 to avoid corrupting your tar
355 file. This flag is mutually exclusive with the x flag.
356
357 · x - Extract (restore) a local tar file back to a share. Unless
358 the -D option is given, the tar files will be restored from the
359 top level of the share. Must be followed by the name of the tar
360 file, device or "-" for standard input. Mutually exclusive with
361 the c flag. Restored files have their creation times (mtime)
362 set to the date saved in the tar file. Directories currently do
363 not get their creation dates restored properly.
364
365 · I - Include files and directories. Is the default behavior when
366 filenames are specified above. Causes files to be included in
367 an extract or create (and therefore everything else to be
368 excluded). See example below. Filename globbing works in one of
369 two ways. See r below.
370
371 · X - Exclude files and directories. Causes files to be excluded
372 from an extract or create. See example below. Filename globbing
373 works in one of two ways. See r below.
374
375 · F - File containing a list of files and directories. The F
376 causes the name following the tarfile to create to be read as a
377 filename that contains a list of files and directories to be
378 included in an extract or create (and therefore everything else
379 to be excluded). See example below. Filename globbing works in
380 one of two ways. See r below.
381
382 · b - Blocksize. Must be followed by a valid (greater than zero)
383 blocksize. Causes tar file to be written out in
384 blocksize*TBLOCK (512 byte) blocks.
385
386 · g - Incremental. Only back up files that have the archive bit
387 set. Useful only with the c flag.
388
389 · q - Quiet. Keeps tar from printing diagnostics as it works.
390 This is the same as tarmode quiet.
391
392 · r - Use wildcard matching to include or exclude. Deprecated.
393
394 · N - Newer than. Must be followed by the name of a file whose
395 date is compared against files found on the share during a
396 create. Only files newer than the file specified are backed up
397 to the tar file. Useful only with the c flag.
398
399 · a - Set archive bit. Causes the archive bit to be reset when a
400 file is backed up. Useful with the g and c flags.
401
402 Tar Long File Names
403
404 smbclient´s tar option now supports long file names both on backup and
405 restore. However, the full path name of the file must be less than 1024
406 bytes. Also, when a tar archive is created, smbclient´s tar option
407 places all files in the archive with relative names, not absolute
408 names.
409
410 Tar Filenames
411
412 All file names can be given as DOS path names (with ´\\´ as the
413 component separator) or as UNIX path names (with ´/´ as the component
414 separator).
415
416 Examples
417
418 Restore from tar file backup.tar into myshare on mypc (no password on
419 share).
420
421 smbclient //mypc/myshare "" -N -Tx backup.tar
422
423 Restore everything except users/docs
424
425 smbclient //mypc/myshare "" -N -TXx backup.tar users/docs
426
427 Create a tar file of the files beneath users/docs.
428
429 smbclient //mypc/myshare "" -N -Tc backup.tar users/docs
430
431 Create the same tar file as above, but now use a DOS path name.
432
433 smbclient //mypc/myshare "" -N -Tc backup.tar users\edocs
434
435 Create a tar file of the files listed in the file tarlist.
436
437 smbclient //mypc/myshare "" -N -TcF backup.tar tarlist
438
439 Create a tar file of all the files and directories in the share.
440
441 smbclient //mypc/myshare "" -N -Tc backup.tar *
442
443 -D|--directory initial directory
444 Change to initial directory before starting. Probably only of any
445 use with the tar -T option.
446
447 -c|--command command string
448 command string is a semicolon-separated list of commands to be
449 executed instead of prompting from stdin.
450 -N is implied by -c.
451
452 This is particularly useful in scripts and for printing stdin to
453 the server, e.g. -c ´print -´.
454
456 Once the client is running, the user is presented with a prompt :
457
458 smb:\>
459
460 The backslash ("\\") indicates the current working directory on the
461 server, and will change if the current working directory is changed.
462
463 The prompt indicates that the client is ready and waiting to carry out
464 a user command. Each command is a single word, optionally followed by
465 parameters specific to that command. Command and parameters are
466 space-delimited unless these notes specifically state otherwise. All
467 commands are case-insensitive. Parameters to commands may or may not be
468 case sensitive, depending on the command.
469
470 You can specify file names which have spaces in them by quoting the
471 name with double quotes, for example "a long file name".
472
473 Parameters shown in square brackets (e.g., "[parameter]") are optional.
474 If not given, the command will use suitable defaults. Parameters shown
475 in angle brackets (e.g., "<parameter>") are required.
476
477 Note that all commands operating on the server are actually performed
478 by issuing a request to the server. Thus the behavior may vary from
479 server to server, depending on how the server was implemented.
480
481 The commands available are given here in alphabetical order.
482
483 ? [command]
484 If command is specified, the ? command will display a brief
485 informative message about the specified command. If no command is
486 specified, a list of available commands will be displayed.
487
488 ! [shell command]
489 If shell command is specified, the ! command will execute a shell
490 locally and run the specified shell command. If no command is
491 specified, a local shell will be run.
492
493 allinfo file
494 The client will request that the server return all known
495 information about a file or directory (including streams).
496
497 altname file
498 The client will request that the server return the "alternate" name
499 (the 8.3 name) for a file or directory.
500
501 archive <number>
502 Sets the archive level when operating on files. 0 means ignore the
503 archive bit, 1 means only operate on files with this bit set, 2
504 means only operate on files with this bit set and reset it after
505 operation, 3 means operate on all files and reset it after
506 operation. The default is 0.
507
508 backup
509 Toggle the state of the "backup intent" flag sent to the server on
510 directory listings and file opens. If the "backup intent" flag is
511 true, the server will try and bypass some file system checks if the
512 user has been granted SE_BACKUP or SE_RESTORE privileges. This
513 state is useful when performing a backup or restore operation.
514
515 blocksize <number>
516 Sets the blocksize parameter for a tar operation. The default is
517 20. Causes tar file to be written out in blocksize*TBLOCK (normally
518 512 byte) units.
519
520 cancel jobid0 [jobid1] ... [jobidN]
521 The client will request that the server cancel the printjobs
522 identified by the given numeric print job ids.
523
524 case_sensitive
525 Toggles the setting of the flag in SMB packets that tells the
526 server to treat filenames as case sensitive. Set to OFF by default
527 (tells file server to treat filenames as case insensitive). Only
528 currently affects Samba 3.0.5 and above file servers with the case
529 sensitive parameter set to auto in the smb.conf.
530
531 cd <directory name>
532 If "directory name" is specified, the current working directory on
533 the server will be changed to the directory specified. This
534 operation will fail if for any reason the specified directory is
535 inaccessible.
536
537 If no directory name is specified, the current working directory on
538 the server will be reported.
539
540 chmod file mode in octal
541 This command depends on the server supporting the CIFS UNIX
542 extensions and will fail if the server does not. The client
543 requests that the server change the UNIX permissions to the given
544 octal mode, in standard UNIX format.
545
546 chown file uid gid
547 This command depends on the server supporting the CIFS UNIX
548 extensions and will fail if the server does not. The client
549 requests that the server change the UNIX user and group ownership
550 to the given decimal values. Note there is currently no way to
551 remotely look up the UNIX uid and gid values for a given name. This
552 may be addressed in future versions of the CIFS UNIX extensions.
553
554 close <fileid>
555 Closes a file explicitly opened by the open command. Used for
556 internal Samba testing purposes.
557
558 del <mask>
559 The client will request that the server attempt to delete all files
560 matching mask from the current working directory on the server.
561
562 dir <mask>
563 A list of the files matching mask in the current working directory
564 on the server will be retrieved from the server and displayed.
565
566 du <filename>
567 Does a directory listing and then prints out the current disk usage
568 and free space on a share.
569
570 echo <number> <data>
571 Does an SMBecho request to ping the server. Used for internal Samba
572 testing purposes.
573
574 exit
575 Terminate the connection with the server and exit from the program.
576
577 get <remote file name> [local file name]
578 Copy the file called remote file name from the server to the
579 machine running the client. If specified, name the local copy local
580 file name. Note that all transfers in smbclient are binary. See
581 also the lowercase command.
582
583 getfacl <filename>
584 Requires the server support the UNIX extensions. Requests and
585 prints the POSIX ACL on a file.
586
587 hardlink <src> <dest>
588 Creates a hardlink on the server using Windows CIFS semantics.
589
590 help [command]
591 See the ? command above.
592
593 history
594 Displays the command history.
595
596 iosize <bytes>
597 When sending or receiving files, smbclient uses an internal buffer
598 sized by the maximum number of allowed requests to the connected
599 server. This command allows this size to be set to any range
600 between 0 (which means use the default server controlled size)
601 bytes and 16776960 (0xFFFF00) bytes. Using the server controlled
602 size is the most efficient as smbclient will pipeline as many
603 simultaneous reads or writes needed to keep the server as busy as
604 possible. Setting this to any other size will slow down the
605 transfer.
606
607 lcd [directory name]
608 If directory name is specified, the current working directory on
609 the local machine will be changed to the directory specified. This
610 operation will fail if for any reason the specified directory is
611 inaccessible.
612
613 If no directory name is specified, the name of the current working
614 directory on the local machine will be reported.
615
616 link target linkname
617 This command depends on the server supporting the CIFS UNIX
618 extensions and will fail if the server does not. The client
619 requests that the server create a hard link between the linkname
620 and target files. The linkname file must not exist.
621
622 listconnect
623 Show the current connections held for DFS purposes.
624
625 lock <filenum> <r|w> <hex-start> <hex-len>
626 This command depends on the server supporting the CIFS UNIX
627 extensions and will fail if the server does not. Tries to set a
628 POSIX fcntl lock of the given type on the given range. Used for
629 internal Samba testing purposes.
630
631 logon <username> <password>
632 Establishes a new vuid for this session by logging on again.
633 Replaces the current vuid. Prints out the new vuid. Used for
634 internal Samba testing purposes.
635
636 logoff
637 Logs the user off the server, closing the session. Used for
638 internal Samba testing purposes.
639
640 lowercase
641 Toggle lowercasing of filenames for the get and mget commands.
642
643 When lowercasing is toggled ON, local filenames are converted to
644 lowercase when using the get and mget commands. This is often
645 useful when copying (say) MSDOS files from a server, because
646 lowercase filenames are the norm on UNIX systems.
647
648 ls <mask>
649 See the dir command above.
650
651 mask <mask>
652 This command allows the user to set up a mask which will be used
653 during recursive operation of the mget and mput commands.
654
655 The masks specified to the mget and mput commands act as filters
656 for directories rather than files when recursion is toggled ON.
657
658 The mask specified with the mask command is necessary to filter
659 files within those directories. For example, if the mask specified
660 in an mget command is "source*" and the mask specified with the
661 mask command is "*.c" and recursion is toggled ON, the mget command
662 will retrieve all files matching "*.c" in all directories below and
663 including all directories matching "source*" in the current working
664 directory.
665
666 Note that the value for mask defaults to blank (equivalent to "*")
667 and remains so until the mask command is used to change it. It
668 retains the most recently specified value indefinitely. To avoid
669 unexpected results it would be wise to change the value of mask
670 back to "*" after using the mget or mput commands.
671
672 md <directory name>
673 See the mkdir command.
674
675 mget <mask>
676 Copy all files matching mask from the server to the machine running
677 the client.
678
679 Note that mask is interpreted differently during recursive
680 operation and non-recursive operation - refer to the recurse and
681 mask commands for more information. Note that all transfers in
682 smbclient are binary. See also the lowercase command.
683
684 mkdir <directory name>
685 Create a new directory on the server (user access privileges
686 permitting) with the specified name.
687
688 more <file name>
689 Fetch a remote file and view it with the contents of your PAGER
690 environment variable.
691
692 mput <mask>
693 Copy all files matching mask in the current working directory on
694 the local machine to the current working directory on the server.
695
696 Note that mask is interpreted differently during recursive
697 operation and non-recursive operation - refer to the recurse and
698 mask commands for more information. Note that all transfers in
699 smbclient are binary.
700
701 posix
702 Query the remote server to see if it supports the CIFS UNIX
703 extensions and prints out the list of capabilities supported. If
704 so, turn on POSIX pathname processing and large file read/writes
705 (if available),.
706
707 posix_encrypt <domain> <username> <password>
708 This command depends on the server supporting the CIFS UNIX
709 extensions and will fail if the server does not. Attempt to
710 negotiate SMB encryption on this connection. If smbclient connected
711 with kerberos credentials (-k) the arguments to this command are
712 ignored and the kerberos credentials are used to negotiate GSSAPI
713 signing and sealing instead. See also the -e option to smbclient to
714 force encryption on initial connection. This command is new with
715 Samba 3.2.
716
717 posix_open <filename> <octal mode>
718 This command depends on the server supporting the CIFS UNIX
719 extensions and will fail if the server does not. Opens a remote
720 file using the CIFS UNIX extensions and prints a fileid. Used for
721 internal Samba testing purposes.
722
723 posix_mkdir <directoryname> <octal mode>
724 This command depends on the server supporting the CIFS UNIX
725 extensions and will fail if the server does not. Creates a remote
726 directory using the CIFS UNIX extensions with the given mode.
727
728 posix_rmdir <directoryname>
729 This command depends on the server supporting the CIFS UNIX
730 extensions and will fail if the server does not. Deletes a remote
731 directory using the CIFS UNIX extensions.
732
733 posix_unlink <filename>
734 This command depends on the server supporting the CIFS UNIX
735 extensions and will fail if the server does not. Deletes a remote
736 file using the CIFS UNIX extensions.
737
738 print <file name>
739 Print the specified file from the local machine through a printable
740 service on the server.
741
742 prompt
743 Toggle prompting for filenames during operation of the mget and
744 mput commands.
745
746 When toggled ON, the user will be prompted to confirm the transfer
747 of each file during these commands. When toggled OFF, all specified
748 files will be transferred without prompting.
749
750 put <local file name> [remote file name]
751 Copy the file called local file name from the machine running the
752 client to the server. If specified, name the remote copy remote
753 file name. Note that all transfers in smbclient are binary. See
754 also the lowercase command.
755
756 queue
757 Displays the print queue, showing the job id, name, size and
758 current status.
759
760 quit
761 See the exit command.
762
763 readlink symlinkname
764 This command depends on the server supporting the CIFS UNIX
765 extensions and will fail if the server does not. Print the value of
766 the symlink "symlinkname".
767
768 rd <directory name>
769 See the rmdir command.
770
771 recurse
772 Toggle directory recursion for the commands mget and mput.
773
774 When toggled ON, these commands will process all directories in the
775 source directory (i.e., the directory they are copying from ) and
776 will recurse into any that match the mask specified to the command.
777 Only files that match the mask specified using the mask command
778 will be retrieved. See also the mask command.
779
780 When recursion is toggled OFF, only files from the current working
781 directory on the source machine that match the mask specified to
782 the mget or mput commands will be copied, and any mask specified
783 using the mask command will be ignored.
784
785 rename <old filename> <new filename>
786 Rename files in the current working directory on the server from
787 old filename to new filename.
788
789 rm <mask>
790 Remove all files matching mask from the current working directory
791 on the server.
792
793 rmdir <directory name>
794 Remove the specified directory (user access privileges permitting)
795 from the server.
796
797 setmode <filename> <perm=[+|\-]rsha>
798 A version of the DOS attrib command to set file permissions. For
799 example:
800
801 setmode myfile +r
802
803 would make myfile read only.
804
805 showconnect
806 Show the currently active connection held for DFS purposes.
807
808 stat file
809 This command depends on the server supporting the CIFS UNIX
810 extensions and will fail if the server does not. The client
811 requests the UNIX basic info level and prints out the same info
812 that the Linux stat command would about the file. This includes the
813 size, blocks used on disk, file type, permissions, inode number,
814 number of links and finally the three timestamps (access, modify
815 and change). If the file is a special file (symlink, character or
816 block device, fifo or socket) then extra information may also be
817 printed.
818
819 symlink target linkname
820 This command depends on the server supporting the CIFS UNIX
821 extensions and will fail if the server does not. The client
822 requests that the server create a symbolic hard link between the
823 target and linkname files. The linkname file must not exist. Note
824 that the server will not create a link to any path that lies
825 outside the currently connected share. This is enforced by the
826 Samba server.
827
828 tar <c|x>[IXbgNa]
829 Performs a tar operation - see the -T command line option above.
830 Behavior may be affected by the tarmode command (see below). Using
831 g (incremental) and N (newer) will affect tarmode settings. Note
832 that using the "-" option with tar x may not work - use the command
833 line option instead.
834
835 blocksize <blocksize>
836 Blocksize. Must be followed by a valid (greater than zero)
837 blocksize. Causes tar file to be written out in blocksize*TBLOCK
838 (512 byte) blocks.
839
840 tarmode <full|inc|reset|noreset|system|nosystem|hidden|nohidden>
841 Changes tar´s behavior with regard to DOS attributes. There are 4
842 modes which can be turned on or off.
843
844 Incremental mode (default off). When off (using full) tar will back
845 up everything regardless of the archive bit setting. When on (using
846 inc), tar will only back up files with the archive bit set.
847
848 Reset mode (default off). When on (using reset), tar will remove
849 the archive bit on all files it backs up (implies read/write
850 share). Use noreset to turn off.
851
852 System mode (default on). When off, tar will not backup system
853 files. Use nosystem to turn off.
854
855 Hidden mode (default on). When off, tar will not backup hidden
856 files. Use nohidden to turn off.
857
858 timeout <per-operation timeout in seconds>
859 This allows the user to tune the default timeout used for each SMB
860 request. The default setting is 20 seconds. Increase it if requests
861 to the server sometimes time out. This can happen when SMB3
862 encryption is selected and smbclient is overwhelming the server
863 with requests.
864
865 unlock <filenum> <hex-start> <hex-len>
866 This command depends on the server supporting the CIFS UNIX
867 extensions and will fail if the server does not. Tries to unlock a
868 POSIX fcntl lock on the given range. Used for internal Samba
869 testing purposes.
870
871 volume
872 Prints the current volume name of the share.
873
874 vuid <number>
875 Changes the currently used vuid in the protocol to the given
876 arbitrary number. Without an argument prints out the current vuid
877 being used. Used for internal Samba testing purposes.
878
879 tcon <sharename>
880 Establishes a new tree connect (connection to a share). Replaces
881 the current tree connect. Prints the new tid (tree id). Used for
882 internal Samba testing purposes.
883
884 tdis
885 Close the current share connection (tree disconnect). Used for
886 internal Samba testing purposes.
887
888 tid <number>
889 Changes the current tree id (tid) in the protocol to a new
890 arbitrary number. Without an argument, it prints out the tid
891 currently used. Used for internal Samba testing purposes.
892
894 Some servers are fussy about the case of supplied usernames, passwords,
895 share names (AKA service names) and machine names. If you fail to
896 connect try giving all parameters in uppercase.
897
898 It is often necessary to use the -n option when connecting to some
899 types of servers. For example OS/2 LanManager insists on a valid
900 NetBIOS name being used, so you need to supply a valid name that would
901 be known to the server.
902
903 smbclient supports long file names where the server supports the
904 LANMAN2 protocol or above.
905
907 The variable USER may contain the username of the person using the
908 client. This information is used only if the protocol level is high
909 enough to support session-level passwords.
910
911 The variable PASSWD may contain the password of the person using the
912 client. This information is used only if the protocol level is high
913 enough to support session-level passwords.
914
915 The variable LIBSMB_PROG may contain the path, executed with system(),
916 which the client should connect to instead of connecting to a server.
917 This functionality is primarily intended as a development aid, and
918 works best when using a LMHOSTS file
919
921 The location of the client program is a matter for individual system
922 administrators. The following are thus suggestions only.
923
924 It is recommended that the smbclient software be installed in the
925 /usr/local/samba/bin/ or /usr/samba/bin/ directory, this directory
926 readable by all, writeable only by root. The client program itself
927 should be executable by all. The client should NOT be setuid or setgid!
928
929 The client log files should be put in a directory readable and
930 writeable only by the user.
931
932 To test the client, you will need to know the name of a running
933 SMB/CIFS server. It is possible to run smbd(8) as an ordinary user -
934 running that server as a daemon on a user-accessible port (typically
935 any port number over 1024) would provide a suitable test server.
936
938 Most diagnostics issued by the client are logged in a specified log
939 file. The log file name is specified at compile time, but may be
940 overridden on the command line.
941
942 The number and nature of diagnostics available depends on the debug
943 level used by the client. If you have problems, set the debug level to
944 3 and peruse the log files.
945
947 This man page is correct for version 3.2 of the Samba suite.
948
950 The original Samba software and related utilities were created by
951 Andrew Tridgell. Samba is now developed by the Samba Team as an Open
952 Source project similar to the way the Linux kernel is developed.
953
954 The original Samba man pages were written by Karl Auer. The man page
955 sources were converted to YODL format (another excellent piece of Open
956 Source software, available at ftp://ftp.icce.rug.nl/pub/unix/) and
957 updated for the Samba 2.0 release by Jeremy Allison. The conversion to
958 DocBook for Samba 2.2 was done by Gerald Carter. The conversion to
959 DocBook XML 4.2 for Samba 3.0 was done by Alexander Bokovoy.
960
961
962
963Samba 4.2 06/19/2018 SMBCLIENT(1)