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