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>IXFvgbNan] [-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 ignored 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 • v - Verbose. Makes tar print out the files being
400 processed. By default tar is not verbose. This is the
401 same as tarmode verbose.
402
403 • r - Use wildcard matching to include or exclude.
404 Deprecated.
405
406 • N - Newer than. Must be followed by the name of a file
407 whose date is compared against files found on the share
408 during a create. Only files newer than the file
409 specified are backed up to the tar file. Useful only
410 with the c flag.
411
412 • a - Set archive bit. Causes the archive bit to be reset
413 when a file is backed up. Useful with the g and c flags.
414
415 Tar Long File Names
416
417 smbclient's tar option now supports long file names both on backup
418 and restore. However, the full path name of the file must be less
419 than 1024 bytes. Also, when a tar archive is created, smbclient's
420 tar option places all files in the archive with relative names, not
421 absolute names.
422
423 Tar Filenames
424
425 All file names can be given as DOS path names (with '\\' as the
426 component separator) or as UNIX path names (with '/' as the
427 component separator).
428
429 Examples
430
431 Restore from tar file backup.tar into myshare on mypc (no password
432 on share).
433
434 smbclient //mypc/myshare "" -N -Tx backup.tar
435
436 Restore everything except users/docs
437
438 smbclient //mypc/myshare "" -N -TXx backup.tar users/docs
439
440 Create a tar file of the files beneath users/docs.
441
442 smbclient //mypc/myshare "" -N -Tc backup.tar users/docs
443
444 Create the same tar file as above, but now use a DOS path name.
445
446 smbclient //mypc/myshare "" -N -Tc backup.tar users\edocs
447
448 Create a tar file of the files listed in the file tarlist.
449
450 smbclient //mypc/myshare "" -N -TcF backup.tar tarlist
451
452 Create a tar file of all the files and directories in the share.
453
454 smbclient //mypc/myshare "" -N -Tc backup.tar *
455
456 -D|--directory initial directory
457 Change to initial directory before starting. Probably only of any
458 use with the tar -T option.
459
460 -c|--command command string
461 command string is a semicolon-separated list of commands to be
462 executed instead of prompting from stdin.
463 -N is implied by -c.
464
465 This is particularly useful in scripts and for printing stdin to
466 the server, e.g. -c 'print -'.
467
469 Once the client is running, the user is presented with a prompt :
470
471 smb:\>
472
473 The backslash ("\\") indicates the current working directory on the
474 server, and will change if the current working directory is changed.
475
476 The prompt indicates that the client is ready and waiting to carry out
477 a user command. Each command is a single word, optionally followed by
478 parameters specific to that command. Command and parameters are
479 space-delimited unless these notes specifically state otherwise. All
480 commands are case-insensitive. Parameters to commands may or may not be
481 case sensitive, depending on the command.
482
483 You can specify file names which have spaces in them by quoting the
484 name with double quotes, for example "a long file name".
485
486 Parameters shown in square brackets (e.g., "[parameter]") are optional.
487 If not given, the command will use suitable defaults. Parameters shown
488 in angle brackets (e.g., "<parameter>") are required.
489
490 Note that all commands operating on the server are actually performed
491 by issuing a request to the server. Thus the behavior may vary from
492 server to server, depending on how the server was implemented.
493
494 The commands available are given here in alphabetical order.
495
496 ? [command]
497 If command is specified, the ? command will display a brief
498 informative message about the specified command. If no command is
499 specified, a list of available commands will be displayed.
500
501 ! [shell command]
502 If shell command is specified, the ! command will execute a shell
503 locally and run the specified shell command. If no command is
504 specified, a local shell will be run.
505
506 allinfo file
507 The client will request that the server return all known
508 information about a file or directory (including streams).
509
510 altname file
511 The client will request that the server return the "alternate" name
512 (the 8.3 name) for a file or directory.
513
514 archive <number>
515 Sets the archive level when operating on files. 0 means ignore the
516 archive bit, 1 means only operate on files with this bit set, 2
517 means only operate on files with this bit set and reset it after
518 operation, 3 means operate on all files and reset it after
519 operation. The default is 0.
520
521 backup
522 Toggle the state of the "backup intent" flag sent to the server on
523 directory listings and file opens. If the "backup intent" flag is
524 true, the server will try and bypass some file system checks if the
525 user has been granted SE_BACKUP or SE_RESTORE privileges. This
526 state is useful when performing a backup or restore operation.
527
528 blocksize <number>
529 Sets the blocksize parameter for a tar operation. The default is
530 20. Causes tar file to be written out in blocksize*TBLOCK (normally
531 512 byte) units.
532
533 cancel jobid0 [jobid1] ... [jobidN]
534 The client will request that the server cancel the printjobs
535 identified by the given numeric print job ids.
536
537 case_sensitive
538 Toggles the setting of the flag in SMB packets that tells the
539 server to treat filenames as case sensitive. Set to OFF by default
540 (tells file server to treat filenames as case insensitive). Only
541 currently affects Samba 3.0.5 and above file servers with the case
542 sensitive parameter set to auto in the smb.conf.
543
544 cd <directory name>
545 If "directory name" is specified, the current working directory on
546 the server will be changed to the directory specified. This
547 operation will fail if for any reason the specified directory is
548 inaccessible.
549
550 If no directory name is specified, the current working directory on
551 the server will be reported.
552
553 chmod file mode in octal
554 This command depends on the server supporting the CIFS UNIX
555 extensions and will fail if the server does not. The client
556 requests that the server change the UNIX permissions to the given
557 octal mode, in standard UNIX format.
558
559 chown file uid gid
560 This command depends on the server supporting the CIFS UNIX
561 extensions and will fail if the server does not. The client
562 requests that the server change the UNIX user and group ownership
563 to the given decimal values. Note there is currently no way to
564 remotely look up the UNIX uid and gid values for a given name. This
565 may be addressed in future versions of the CIFS UNIX extensions.
566
567 close <fileid>
568 Closes a file explicitly opened by the open command. Used for
569 internal Samba testing purposes.
570
571 del <mask>
572 The client will request that the server attempt to delete all files
573 matching mask from the current working directory on the server.
574
575 deltree <mask>
576 The client will request that the server attempt to delete all files
577 and directories matching mask from the current working directory on
578 the server. Note this will recursively delete files and directories
579 within the directories selected even without the recurse command
580 being set. If any of the delete requests fail the command will stop
581 processing at that point, leaving files and directories not yet
582 processed untouched. This is by design.
583
584 dir <mask>
585 A list of the files matching mask in the current working directory
586 on the server will be retrieved from the server and displayed.
587
588 du <filename>
589 Does a directory listing and then prints out the current disk usage
590 and free space on a share.
591
592 echo <number> <data>
593 Does an SMBecho request to ping the server. Used for internal Samba
594 testing purposes.
595
596 exit
597 Terminate the connection with the server and exit from the program.
598
599 get <remote file name> [local file name]
600 Copy the file called remote file name from the server to the
601 machine running the client. If specified, name the local copy local
602 file name. Note that all transfers in smbclient are binary. See
603 also the lowercase command.
604
605 getfacl <filename>
606 Requires the server support the UNIX extensions. Requests and
607 prints the POSIX ACL on a file.
608
609 hardlink <src> <dest>
610 Creates a hardlink on the server using Windows CIFS semantics.
611
612 help [command]
613 See the ? command above.
614
615 history
616 Displays the command history.
617
618 iosize <bytes>
619 When sending or receiving files, smbclient uses an internal buffer
620 sized by the maximum number of allowed requests to the connected
621 server. This command allows this size to be set to any range
622 between 0 (which means use the default server controlled size)
623 bytes and 16776960 (0xFFFF00) bytes. Using the server controlled
624 size is the most efficient as smbclient will pipeline as many
625 simultaneous reads or writes needed to keep the server as busy as
626 possible. Setting this to any other size will slow down the
627 transfer.
628
629 lcd [directory name]
630 If directory name is specified, the current working directory on
631 the local machine will be changed to the directory specified. This
632 operation will fail if for any reason the specified directory is
633 inaccessible.
634
635 If no directory name is specified, the name of the current working
636 directory on the local machine will be reported.
637
638 link target linkname
639 This command depends on the server supporting the CIFS UNIX
640 extensions and will fail if the server does not. The client
641 requests that the server create a hard link between the linkname
642 and target files. The linkname file must not exist.
643
644 listconnect
645 Show the current connections held for DFS purposes.
646
647 lock <filenum> <r|w> <hex-start> <hex-len>
648 This command depends on the server supporting the CIFS UNIX
649 extensions and will fail if the server does not. Tries to set a
650 POSIX fcntl lock of the given type on the given range. Used for
651 internal Samba testing purposes.
652
653 logon <username> <password>
654 Establishes a new vuid for this session by logging on again.
655 Replaces the current vuid. Prints out the new vuid. Used for
656 internal Samba testing purposes.
657
658 logoff
659 Logs the user off the server, closing the session. Used for
660 internal Samba testing purposes.
661
662 lowercase
663 Toggle lowercasing of filenames for the get and mget commands.
664
665 When lowercasing is toggled ON, local filenames are converted to
666 lowercase when using the get and mget commands. This is often
667 useful when copying (say) MSDOS files from a server, because
668 lowercase filenames are the norm on UNIX systems.
669
670 ls <mask>
671 See the dir command above.
672
673 mask <mask>
674 This command allows the user to set up a mask which will be used
675 during recursive operation of the mget and mput commands.
676
677 The masks specified to the mget and mput commands act as filters
678 for directories rather than files when recursion is toggled ON.
679
680 The mask specified with the mask command is necessary to filter
681 files within those directories. For example, if the mask specified
682 in an mget command is "source*" and the mask specified with the
683 mask command is "*.c" and recursion is toggled ON, the mget command
684 will retrieve all files matching "*.c" in all directories below and
685 including all directories matching "source*" in the current working
686 directory.
687
688 Note that the value for mask defaults to blank (equivalent to "*")
689 and remains so until the mask command is used to change it. It
690 retains the most recently specified value indefinitely. To avoid
691 unexpected results it would be wise to change the value of mask
692 back to "*" after using the mget or mput commands.
693
694 md <directory name>
695 See the mkdir command.
696
697 mget <mask>
698 Copy all files matching mask from the server to the machine running
699 the client.
700
701 Note that mask is interpreted differently during recursive
702 operation and non-recursive operation - refer to the recurse and
703 mask commands for more information. Note that all transfers in
704 smbclient are binary. See also the lowercase command.
705
706 mkdir <directory name>
707 Create a new directory on the server (user access privileges
708 permitting) with the specified name.
709
710 more <file name>
711 Fetch a remote file and view it with the contents of your PAGER
712 environment variable.
713
714 mput <mask>
715 Copy all files matching mask in the current working directory on
716 the local machine to the current working directory on the server.
717
718 Note that mask is interpreted differently during recursive
719 operation and non-recursive operation - refer to the recurse and
720 mask commands for more information. Note that all transfers in
721 smbclient are binary.
722
723 notify <dir name>
724 Query a directory for change notifications. This command issues a
725 recursive filechangenotify call for all possible changes. As
726 changes come in will print one line per change. See
727 https://msdn.microsoft.com/en-us/library/dn392331.aspx for a
728 description of the action numbers that this command prints.
729
730 This command never ends, it waits for event indefinitely.
731
732 posix
733 Query the remote server to see if it supports the CIFS UNIX
734 extensions and prints out the list of capabilities supported. If
735 so, turn on POSIX pathname processing and large file read/writes
736 (if available),.
737
738 posix_encrypt <domain> <username> <password>
739 This command depends on the server supporting the CIFS UNIX
740 extensions and will fail if the server does not. Attempt to
741 negotiate SMB encryption on this connection. If smbclient connected
742 with kerberos credentials (-k) the arguments to this command are
743 ignored and the kerberos credentials are used to negotiate GSSAPI
744 signing and sealing instead. See also the -e option to smbclient to
745 force encryption on initial connection. This command is new with
746 Samba 3.2.
747
748 posix_open <filename> <octal mode>
749 This command depends on the server supporting the CIFS UNIX
750 extensions and will fail if the server does not. Opens a remote
751 file using the CIFS UNIX extensions and prints a fileid. Used for
752 internal Samba testing purposes.
753
754 posix_mkdir <directoryname> <octal mode>
755 This command depends on the server supporting the CIFS UNIX
756 extensions and will fail if the server does not. Creates a remote
757 directory using the CIFS UNIX extensions with the given mode.
758
759 posix_rmdir <directoryname>
760 This command depends on the server supporting the CIFS UNIX
761 extensions and will fail if the server does not. Deletes a remote
762 directory using the CIFS UNIX extensions.
763
764 posix_unlink <filename>
765 This command depends on the server supporting the CIFS UNIX
766 extensions and will fail if the server does not. Deletes a remote
767 file using the CIFS UNIX extensions.
768
769 posix_whoami
770 Query the remote server for the user token using the CIFS UNIX
771 extensions WHOAMI call. Prints out the guest status, user, group,
772 group list and sid list that the remote server is using on behalf
773 of the logged on user.
774
775 print <file name>
776 Print the specified file from the local machine through a printable
777 service on the server.
778
779 prompt
780 Toggle prompting for filenames during operation of the mget and
781 mput commands.
782
783 When toggled ON, the user will be prompted to confirm the transfer
784 of each file during these commands. When toggled OFF, all specified
785 files will be transferred without prompting.
786
787 put <local file name> [remote file name]
788 Copy the file called local file name from the machine running the
789 client to the server. If specified, name the remote copy remote
790 file name. Note that all transfers in smbclient are binary. See
791 also the lowercase command.
792
793 queue
794 Displays the print queue, showing the job id, name, size and
795 current status.
796
797 quit
798 See the exit command.
799
800 readlink symlinkname
801 This command depends on the server supporting the CIFS UNIX
802 extensions and will fail if the server does not. Print the value of
803 the symlink "symlinkname".
804
805 rd <directory name>
806 See the rmdir command.
807
808 recurse
809 Toggle directory recursion for the commands mget and mput.
810
811 When toggled ON, these commands will process all directories in the
812 source directory (i.e., the directory they are copying from ) and
813 will recurse into any that match the mask specified to the command.
814 Only files that match the mask specified using the mask command
815 will be retrieved. See also the mask command.
816
817 When recursion is toggled OFF, only files from the current working
818 directory on the source machine that match the mask specified to
819 the mget or mput commands will be copied, and any mask specified
820 using the mask command will be ignored.
821
822 rename <old filename> <new filename> [-f]
823 Rename files in the current working directory on the server from
824 old filename to new filename. The optional -f switch allows for
825 superseding the destination file, if it exists. This is supported
826 by NT1 protocol dialect and SMB2 protocol family.
827
828 rm <mask>
829 Remove all files matching mask from the current working directory
830 on the server.
831
832 rmdir <directory name>
833 Remove the specified directory (user access privileges permitting)
834 from the server.
835
836 scopy <source filename> <destination filename>
837 Attempt to copy a file on the server using the most efficient
838 server-side copy calls. Falls back to using read then write if
839 server doesn't support server-side copy.
840
841 setmode <filename> <perm=[+|\-]rsha>
842 A version of the DOS attrib command to set file permissions. For
843 example:
844
845 setmode myfile +r
846
847 would make myfile read only.
848
849 showconnect
850 Show the currently active connection held for DFS purposes.
851
852 stat file
853 This command depends on the server supporting the CIFS UNIX
854 extensions and will fail if the server does not. The client
855 requests the UNIX basic info level and prints out the same info
856 that the Linux stat command would about the file. This includes the
857 size, blocks used on disk, file type, permissions, inode number,
858 number of links and finally the three timestamps (access, modify
859 and change). If the file is a special file (symlink, character or
860 block device, fifo or socket) then extra information may also be
861 printed.
862
863 symlink target linkname
864 This command depends on the server supporting the CIFS UNIX
865 extensions and will fail if the server does not. The client
866 requests that the server create a symbolic hard link between the
867 target and linkname files. The linkname file must not exist. Note
868 that the server will not create a link to any path that lies
869 outside the currently connected share. This is enforced by the
870 Samba server.
871
872 tar <c|x>[IXbgNa]
873 Performs a tar operation - see the -T command line option above.
874 Behavior may be affected by the tarmode command (see below). Using
875 g (incremental) and N (newer) will affect tarmode settings. Note
876 that using the "-" option with tar x may not work - use the command
877 line option instead.
878
879 blocksize <blocksize>
880 Blocksize. Must be followed by a valid (greater than zero)
881 blocksize. Causes tar file to be written out in blocksize*TBLOCK
882 (512 byte) blocks.
883
884 tarmode
885 <full|inc|reset|noreset|system|nosystem|hidden|nohidden|verbose|noverbose>
886 Changes tar's behavior with regard to DOS attributes. There are 4
887 modes which can be turned on or off.
888
889 Incremental mode (default off). When off (using full) tar will back
890 up everything regardless of the archive bit setting. When on (using
891 inc), tar will only back up files with the archive bit set.
892
893 Reset mode (default off). When on (using reset), tar will remove
894 the archive bit on all files it backs up (implies read/write
895 share). Use noreset to turn off.
896
897 System mode (default on). When off, tar will not backup system
898 files. Use nosystem to turn off.
899
900 Hidden mode (default on). When off, tar will not backup hidden
901 files. Use nohidden to turn off.
902
903 timeout <per-operation timeout in seconds>
904 This allows the user to tune the default timeout used for each SMB
905 request. The default setting is 20 seconds. Increase it if requests
906 to the server sometimes time out. This can happen when SMB3
907 encryption is selected and smbclient is overwhelming the server
908 with requests.
909
910 unlock <filenum> <hex-start> <hex-len>
911 This command depends on the server supporting the CIFS UNIX
912 extensions and will fail if the server does not. Tries to unlock a
913 POSIX fcntl lock on the given range. Used for internal Samba
914 testing purposes.
915
916 volume
917 Prints the current volume name of the share.
918
919 vuid <number>
920 Changes the currently used vuid in the protocol to the given
921 arbitrary number. Without an argument prints out the current vuid
922 being used. Used for internal Samba testing purposes.
923
924 tcon <sharename>
925 Establishes a new tree connect (connection to a share). Replaces
926 the current tree connect. Prints the new tid (tree id). Used for
927 internal Samba testing purposes.
928
929 tdis
930 Close the current share connection (tree disconnect). Used for
931 internal Samba testing purposes.
932
933 tid <number>
934 Changes the current tree id (tid) in the protocol to a new
935 arbitrary number. Without an argument, it prints out the tid
936 currently used. Used for internal Samba testing purposes.
937
938 utimes <filename> <create time> <access time> <write time> < change
939 time>
940 Changes the timestamps on a file by name. Times should be specified
941 in the format [YY]YY:MM:DD-HH:MM:SS or -1 for no change.
942
944 Some servers are fussy about the case of supplied usernames, passwords,
945 share names (AKA service names) and machine names. If you fail to
946 connect try giving all parameters in uppercase.
947
948 It is often necessary to use the -n option when connecting to some
949 types of servers. For example OS/2 LanManager insists on a valid
950 NetBIOS name being used, so you need to supply a valid name that would
951 be known to the server.
952
953 smbclient supports long file names where the server supports the
954 LANMAN2 protocol or above.
955
957 The variable USER may contain the username of the person using the
958 client. This information is used only if the protocol level is high
959 enough to support session-level passwords.
960
961 The variable PASSWD may contain the password of the person using the
962 client. This information is used only if the protocol level is high
963 enough to support session-level passwords.
964
966 The location of the client program is a matter for individual system
967 administrators. The following are thus suggestions only.
968
969 It is recommended that the smbclient software be installed in the
970 /usr/local/samba/bin/ or /usr/samba/bin/ directory, this directory
971 readable by all, writeable only by root. The client program itself
972 should be executable by all. The client should NOT be setuid or setgid!
973
974 The client log files should be put in a directory readable and
975 writeable only by the user.
976
977 To test the client, you will need to know the name of a running
978 SMB/CIFS server. It is possible to run smbd(8) as an ordinary user -
979 running that server as a daemon on a user-accessible port (typically
980 any port number over 1024) would provide a suitable test server.
981
983 Most diagnostics issued by the client are logged in a specified log
984 file. The log file name is specified at compile time, but may be
985 overridden on the command line.
986
987 The number and nature of diagnostics available depends on the debug
988 level used by the client. If you have problems, set the debug level to
989 3 and peruse the log files.
990
992 This man page is part of version 4.14.5 of the Samba suite.
993
995 The original Samba software and related utilities were created by
996 Andrew Tridgell. Samba is now developed by the Samba Team as an Open
997 Source project similar to the way the Linux kernel is developed.
998
999
1000
1001Samba 4.14.5 06/01/2021 SMBCLIENT(1)