1SMBCLIENT(1)                     User Commands                    SMBCLIENT(1)
2
3
4

NAME

6       smbclient - ftp-like client to access SMB/CIFS resources on servers
7

SYNOPSIS

9       smbclient [-M|--message=HOST] [-I|--ip-address=IP] [-E|--stderr]
10        [-L|--list=HOST] [-T|--tar=<c|x>IXFvgbNan] [-D|--directory=DIR]
11        [-b|--send-buffer=BYTES] [-t|--timeout=SECONDS] [-p|--port=PORT]
12        [-g|--grepable] [-q|--quiet] [-B|--browse] [-?|--help] [--usage]
13        [-d|--debuglevel=DEBUGLEVEL] [--debug-stdout]
14        [-s|--configfile=CONFIGFILE] [--option=name=value]
15        [-l|--log-basename=LOGFILEBASE] [--leak-report] [--leak-report-full]
16        [-R|--name-resolve=NAME-RESOLVE-ORDER]
17        [-O|--socket-options=SOCKETOPTIONS] [-m|--max-protocol=MAXPROTOCOL]
18        [-n|--netbiosname=NETBIOSNAME] [--netbios-scope=SCOPE]
19        [-W|--workgroup=WORKGROUP] [--realm=REALM]
20        [-U|--user=[DOMAIN/]USERNAME%[PASSWORD]] [-N|--no-pass]
21        [--password=STRING] [--pw-nt-hash] [-A|--authentication-file=FILE]
22        [-P|--machine-pass] [--simple-bind-dn=DN]
23        [--use-kerberos=desired|required|off] [--use-krb5-ccache=CCACHE]
24        [--use-winbind-ccache] [--client-protection=sign|encrypt|off]
25        [-V|--version] [-c|--command=STRING]
26

DESCRIPTION

28       This tool is part of the samba(7) suite.
29
30       smbclient is a client that can 'talk' to an SMB/CIFS server. It offers
31       an interface similar to that of the ftp program (see ftp(1)).
32       Operations include things like getting files from the server to the
33       local machine, putting files from the local machine to the server,
34       retrieving directory information from the server and so on.
35

OPTIONS

37       servicename
38           servicename is the name of the service you want to use on the
39           server. A service name takes the form //server/service where server
40           is the NetBIOS name of the SMB/CIFS server offering the desired
41           service and service is the name of the service offered. Thus to
42           connect to the service "printer" on the SMB/CIFS server
43           "smbserver", you would use the servicename //smbserver/printer
44
45           Note that the server name required is NOT necessarily the IP (DNS)
46           host name of the server ! The name required is a NetBIOS server
47           name, which may or may not be the same as the IP hostname of the
48           machine running the server.
49
50           The server name is looked up according to either the
51           -R|--name-resolve parameter to smbclient or using the name resolve
52           order parameter in the smb.conf(5) file, allowing an administrator
53           to change the order and methods by which server names are looked
54           up.
55
56       password
57           The password required to access the specified service on the
58           specified server. If this parameter is supplied, the -N option
59           (suppress password prompt) is assumed.
60
61           There is no default password. If no password is supplied on the
62           command line (either by using this parameter or adding a password
63           to the -U option (see below)) and the -N option is not specified,
64           the client will prompt for a password, even if the desired service
65           does not require one. (If no password is required, simply press
66           ENTER to provide a null password.)
67
68           Note: Some servers (including OS/2 and Windows for Workgroups)
69           insist on an uppercase password. Lowercase or mixed case passwords
70           may be rejected by these servers.
71
72           Be cautious about including passwords in scripts.
73
74       -M|--message NetBIOS name
75           This options allows you to send messages, using the "WinPopup"
76           protocol, to another computer. Once a connection is established you
77           then type your message, pressing ^D (control-D) to end.
78
79           If the receiving computer is running WinPopup the user will receive
80           the message and probably a beep. If they are not running WinPopup
81           the message will be lost, and no error message will occur.
82
83           The message is also automatically truncated if the message is over
84           1600 bytes, as this is the limit of the protocol.
85
86           One useful trick is to pipe the message through smbclient. For
87           example: smbclient -M FRED < mymessage.txt will send the message in
88           the file mymessage.txt to the machine FRED.
89
90           You may also find the -U and -I options useful, as they allow you
91           to control the FROM and TO parts of the message.
92
93           See the message command parameter in the smb.conf(5) for a
94           description of how to handle incoming WinPopup messages in Samba.
95
96           Note: Copy WinPopup into the startup group on your WfWg PCs if you
97           want them to always be able to receive messages.
98
99       -p|--port port
100           This number is the TCP port number that will be used when making
101           connections to the server. The standard (well-known) TCP port
102           number for an SMB/CIFS server is 139, which is the default.
103
104       -g|--grepable
105           This parameter provides combined with -L easy parseable output that
106           allows processing with utilities such as grep and cut.
107
108       -m|--max-protocol protocol
109           This allows the user to select the highest SMB protocol level that
110           smbclient will use to connect to the server. By default this is set
111           to highest available SMB3 protocol version. To connect using SMB2
112           or SMB1 protocol, use the strings SMB2 or NT1 respectively. Note
113           that to connect to a Windows 2012 server with encrypted transport
114           selecting a max-protocol of SMB3 is required.
115
116       -P|--machine-pass
117           Make queries to the external server using the machine account of
118           the local server.
119
120       -I|--ip-address IP-address
121           IP address is the address of the server to connect to. It should be
122           specified in standard "a.b.c.d" notation.
123
124           Normally the client would attempt to locate a named SMB/CIFS server
125           by looking it up via the NetBIOS name resolution mechanism
126           described above in the name resolve order parameter above. Using
127           this parameter will force the client to assume that the server is
128           on the machine with the specified IP address and the NetBIOS name
129           component of the resource being connected to will be ignored.
130
131           There is no default for this parameter. If not supplied, it will be
132           determined automatically by the client as described above.
133
134       -E|--stderr
135           This parameter causes the client to write messages to the standard
136           error stream (stderr) rather than to the standard output stream.
137
138           By default, the client writes messages to standard output -
139           typically the user's tty.
140
141       -L|--list
142           This option allows you to look at what services are available on a
143           server. You use it as smbclient -L host and a list should appear.
144           The -I option may be useful if your NetBIOS names don't match your
145           TCP/IP DNS host names or if you are trying to reach a host on
146           another network.
147
148       -b|--send-buffer buffersize
149           When sending or receiving files, smbclient uses an internal buffer
150           sized by the maximum number of allowed requests to the connected
151           server. This command allows this size to be set to any range
152           between 0 (which means use the default server controlled size)
153           bytes and 16776960 (0xFFFF00) bytes. Using the server controlled
154           size is the most efficient as smbclient will pipeline as many
155           simultaneous reads or writes needed to keep the server as busy as
156           possible. Setting this to any other size will slow down the
157           transfer. This can also be set using the iosize command inside
158           smbclient.
159
160       -B|--browse
161           Browse SMB servers using DNS.
162
163       -t|--timeout <timeout-seconds>
164           This allows the user to tune the default timeout used for each SMB
165           request. The default setting is 20 seconds. Increase it if requests
166           to the server sometimes time out. This can happen when SMB3
167           encryption is selected and smbclient is overwhelming the server
168           with requests. This can also be set using the timeout command
169           inside smbclient.
170
171       -T|--tar tar options
172           smbclient may be used to create tar(1) compatible backups of all
173           the files on an SMB/CIFS share. The secondary tar flags that can be
174           given to this option are:
175
176c - Create a tar backup archive on the local system.
177                      Must be followed by the name of a tar file, tape device
178                      or "-" for standard output. If using standard output you
179                      must turn the log level to its lowest value -d0 to avoid
180                      corrupting your tar file. This flag is mutually
181                      exclusive with the x flag.
182
183n - In combination with the c flag, do not actually
184                      create the archive, instead perform a dry run that
185                      attempts everything that involved in creation other than
186                      writing the file.
187
188x - Extract (restore) a local tar file back to a share.
189                      Unless the -D option is given, the tar files will be
190                      restored from the top level of the share. Must be
191                      followed by the name of the tar file, device or "-" for
192                      standard input. Mutually exclusive with the c flag.
193                      Restored files have their creation times (mtime) set to
194                      the date saved in the tar file. Directories currently do
195                      not get their creation dates restored properly.
196
197I - Include files and directories. Is the default
198                      behavior when filenames are specified above. Causes
199                      files to be included in an extract or create (and
200                      therefore everything else to be excluded). See example
201                      below. Filename globbing works in one of two ways. See r
202                      below.
203
204X - Exclude files and directories. Causes files to be
205                      excluded from an extract or create. See example below.
206                      Filename globbing works in one of two ways. See r below.
207
208F - File containing a list of files and directories. The
209                      F causes the name following the tarfile to create to be
210                      read as a filename that contains a list of files and
211                      directories to be included in an extract or create (and
212                      therefore everything else to be excluded). See example
213                      below. Filename globbing works in one of two ways. See r
214                      below.
215
216b - Blocksize. Must be followed by a valid (greater than
217                      zero) blocksize. Causes tar file to be written out in
218                      blocksize*TBLOCK (512 byte) blocks.
219
220g - Incremental. Only back up files that have the
221                      archive bit set. Useful only with the c flag.
222
223v - Verbose. Makes tar print out the files being
224                      processed. By default tar is not verbose. This is the
225                      same as tarmode verbose.
226
227r - Use wildcard matching to include or exclude.
228                      Deprecated.
229
230N - Newer than. Must be followed by the name of a file
231                      whose date is compared against files found on the share
232                      during a create. Only files newer than the file
233                      specified are backed up to the tar file. Useful only
234                      with the c flag.
235
236a - Set archive bit. Causes the archive bit to be reset
237                      when a file is backed up. Useful with the g and c flags.
238
239           Tar Long File Names
240
241           smbclient's tar option now supports long file names both on backup
242           and restore. However, the full path name of the file must be less
243           than 1024 bytes. Also, when a tar archive is created, smbclient's
244           tar option places all files in the archive with relative names, not
245           absolute names.
246
247           Tar Filenames
248
249           All file names can be given as DOS path names (with '\\' as the
250           component separator) or as UNIX path names (with '/' as the
251           component separator).
252
253           Examples
254
255           Restore from tar file backup.tar into myshare on mypc (no password
256           on share).
257
258           smbclient //mypc/myshare "" -N -Tx backup.tar
259
260           Restore everything except users/docs
261
262           smbclient //mypc/myshare "" -N -TXx backup.tar users/docs
263
264           Create a tar file of the files beneath users/docs.
265
266           smbclient //mypc/myshare "" -N -Tc backup.tar users/docs
267
268           Create the same tar file as above, but now use a DOS path name.
269
270           smbclient //mypc/myshare "" -N -Tc backup.tar users\edocs
271
272           Create a tar file of the files listed in the file tarlist.
273
274           smbclient //mypc/myshare "" -N -TcF backup.tar tarlist
275
276           Create a tar file of all the files and directories in the share.
277
278           smbclient //mypc/myshare "" -N -Tc backup.tar *
279
280       -D|--directory initial directory
281           Change to initial directory before starting. Probably only of any
282           use with the tar -T option.
283
284       -c|--command command string
285           command string is a semicolon-separated list of commands to be
286           executed instead of prompting from stdin.
287            -N is implied by -c.
288
289           This is particularly useful in scripts and for printing stdin to
290           the server, e.g.  -c 'print -'.
291
292       -?|--help
293           Print a summary of command line options.
294
295       --usage
296           Display brief usage message.
297
298       -d|--debuglevel=DEBUGLEVEL
299           level is an integer from 0 to 10. The default value if this
300           parameter is not specified is 1 for client applications.
301
302           The higher this value, the more detail will be logged to the log
303           files about the activities of the server. At level 0, only critical
304           errors and serious warnings will be logged. Level 1 is a reasonable
305           level for day-to-day running - it generates a small amount of
306           information about operations carried out.
307
308           Levels above 1 will generate considerable amounts of log data, and
309           should only be used when investigating a problem. Levels above 3
310           are designed for use only by developers and generate HUGE amounts
311           of log data, most of which is extremely cryptic.
312
313           Note that specifying this parameter here will override the log
314           level parameter in the /etc/samba/smb.conf file.
315
316       --debug-stdout
317           This will redirect debug output to STDOUT. By default all clients
318           are logging to STDERR.
319
320       --configfile=<configuration file>
321           The file specified contains the configuration details required by
322           the client. The information in this file can be general for client
323           and server or only provide client specific like options such as
324           client smb encrypt. See /etc/samba/smb.conf for more information.
325           The default configuration file name is determined at compile time.
326
327       --option=<name>=<value>
328           Set the smb.conf(5) option "<name>" to value "<value>" from the
329           command line. This overrides compiled-in defaults and options read
330           from the configuration file. If a name or a value includes a space,
331           wrap whole --option=name=value into quotes.
332
333       -l|--log-basename=logdirectory
334           Base directory name for log/debug files. The extension ".progname"
335           will be appended (e.g. log.smbclient, log.smbd, etc...). The log
336           file is never removed by the client.
337
338       --leak-report
339           Enable talloc leak reporting on exit.
340
341       --leak-report-full
342           Enable full talloc leak reporting on exit.
343
344       -V|--version
345           Prints the program version number.
346
347       -R|--name-resolve=NAME-RESOLVE-ORDER
348           This option is used to determine what naming services and in what
349           order to resolve host names to IP addresses. The option takes a
350           space-separated string of different name resolution options. The
351           best ist to wrap the whole --name-resolve=NAME-RESOLVE-ORDER into
352           quotes.
353
354           The options are: "lmhosts", "host", "wins" and "bcast". They cause
355           names to be resolved as follows:
356
357lmhosts: Lookup an IP address in the Samba lmhosts file.
358                      If the line in lmhosts has no name type attached to the
359                      NetBIOS name (see the lmhosts(5) for details) then any
360                      name type matches for lookup.
361
362host: Do a standard host name to IP address resolution,
363                      using the system /etc/hosts, NIS, or DNS lookups. This
364                      method of name resolution is operating system dependent,
365                      for instance on IRIX or Solaris this may be controlled
366                      by the /etc/nsswitch.conf file). Note that this method
367                      is only used if the NetBIOS name type being queried is
368                      the 0x20 (server) name type, otherwise it is ignored.
369
370wins: Query a name with the IP address listed in the
371                      wins server parameter. If no WINS server has been
372                      specified this method will be ignored.
373
374bcast: Do a broadcast on each of the known local
375                      interfaces listed in the interfaces parameter. This is
376                      the least reliable of the name resolution methods as it
377                      depends on the target host being on a locally connected
378                      subnet.
379
380           If this parameter is not set then the name resolve order defined in
381           the /etc/samba/smb.conf file parameter (name resolve order) will be
382           used.
383
384           The default order is lmhosts, host, wins, bcast. Without this
385           parameter or any entry in the name resolve order parameter of the
386           /etc/samba/smb.conf file, the name resolution methods will be
387           attempted in this order.
388
389       -O|--socket-options=SOCKETOPTIONS
390           TCP socket options to set on the client socket. See the socket
391           options parameter in the /etc/samba/smb.conf manual page for the
392           list of valid options.
393
394       -m|--max-protocol=MAXPROTOCOL
395           The value of the parameter (a string) is the highest protocol level
396           that will be supported by the client.
397
398           Note that specifying this parameter here will override the client
399           max protocol parameter in the /etc/samba/smb.conf file.
400
401       -n|--netbiosname=NETBIOSNAME
402           This option allows you to override the NetBIOS name that Samba uses
403           for itself. This is identical to setting the netbios name parameter
404           in the /etc/samba/smb.conf file. However, a command line setting
405           will take precedence over settings in /etc/samba/smb.conf.
406
407       --netbios-scope=SCOPE
408           This specifies a NetBIOS scope that nmblookup will use to
409           communicate with when generating NetBIOS names. For details on the
410           use of NetBIOS scopes, see rfc1001.txt and rfc1002.txt. NetBIOS
411           scopes are very rarely used, only set this parameter if you are the
412           system administrator in charge of all the NetBIOS systems you
413           communicate with.
414
415       -W|--workgroup=WORKGROUP
416           Set the SMB domain of the username. This overrides the default
417           domain which is the domain defined in smb.conf. If the domain
418           specified is the same as the servers NetBIOS name, it causes the
419           client to log on using the servers local SAM (as opposed to the
420           Domain SAM).
421
422           Note that specifying this parameter here will override the
423           workgroup parameter in the /etc/samba/smb.conf file.
424
425       -r|--realm=REALM
426           Set the realm for the domain.
427
428           Note that specifying this parameter here will override the realm
429           parameter in the /etc/samba/smb.conf file.
430
431       -U|--user=[DOMAIN\]USERNAME[%PASSWORD]
432           Sets the SMB username or username and password.
433
434           If %PASSWORD is not specified, the user will be prompted. The
435           client will first check the USER environment variable (which is
436           also permitted to also contain the password separated by a %), then
437           the LOGNAME variable (which is not permitted to contain a password)
438           and if either exists, the value is used. If these environmental
439           variables are not found, the username found in a Kerberos
440           Credentials cache may be used.
441
442           A third option is to use a credentials file which contains the
443           plaintext of the username and password. This option is mainly
444           provided for scripts where the admin does not wish to pass the
445           credentials on the command line or via environment variables. If
446           this method is used, make certain that the permissions on the file
447           restrict access from unwanted users. See the -A for more details.
448
449           Be cautious about including passwords in scripts or passing
450           user-supplied values onto the command line. For security it is
451           better to let the Samba client tool ask for the password if needed,
452           or obtain the password once with kinit.
453
454           While Samba will attempt to scrub the password from the process
455           title (as seen in ps), this is after startup and so is subject to a
456           race.
457
458       -N|--no-pass
459           If specified, this parameter suppresses the normal password prompt
460           from the client to the user. This is useful when accessing a
461           service that does not require a password.
462
463           Unless a password is specified on the command line or this
464           parameter is specified, the client will request a password.
465
466           If a password is specified on the command line and this option is
467           also defined the password on the command line will be silently
468           ignored and no password will be used.
469
470       --password
471           Specify the password on the commandline.
472
473           Be cautious about including passwords in scripts or passing
474           user-supplied values onto the command line. For security it is
475           better to let the Samba client tool ask for the password if needed,
476           or obtain the password once with kinit.
477
478           If --password is not specified, the tool will check the PASSWD
479           environment variable, followed by PASSWD_FD which is expected to
480           contain an open file descriptor (FD) number.
481
482           Finally it will check PASSWD_FILE (containing a file path to be
483           opened). The file should only contain the password. Make certain
484           that the permissions on the file restrict access from unwanted
485           users!
486
487           While Samba will attempt to scrub the password from the process
488           title (as seen in ps), this is after startup and so is subject to a
489           race.
490
491       --pw-nt-hash
492           The supplied password is the NT hash.
493
494       -A|--authentication-file=filename
495           This option allows you to specify a file from which to read the
496           username and password used in the connection. The format of the
497           file is:
498
499                                   username = <value>
500                                   password = <value>
501                                   domain   = <value>
502
503
504           Make certain that the permissions on the file restrict access from
505           unwanted users!
506
507       -P|--machine-pass
508           Use stored machine account password.
509
510       --simple-bind-dn=DN
511           DN to use for a simple bind.
512
513       --use-kerberos=desired|required|off
514           This parameter determines whether Samba client tools will try to
515           authenticate using Kerberos. For Kerberos authentication you need
516           to use dns names instead of IP addresses when connecting to a
517           service.
518
519           Note that specifying this parameter here will override the client
520           use kerberos parameter in the /etc/samba/smb.conf file.
521
522       --use-krb5-ccache=CCACHE
523           Specifies the credential cache location for Kerberos
524           authentication.
525
526           This will set --use-kerberos=required too.
527
528       --use-winbind-ccache
529           Try to use the credential cache by winbind.
530
531       --client-protection=sign|encrypt|off
532           Sets the connection protection the client tool should use.
533
534           Note that specifying this parameter here will override the client
535           protection parameter in the /etc/samba/smb.conf file.
536
537           In case you need more fine grained control you can use:
538           --option=clientsmbencrypt=OPTION, --option=clientipcsigning=OPTION,
539           --option=clientsigning=OPTION.
540

OPERATIONS

542       Once the client is running, the user is presented with a prompt :
543
544       smb:\>
545
546       The backslash ("\\") indicates the current working directory on the
547       server, and will change if the current working directory is changed.
548
549       The prompt indicates that the client is ready and waiting to carry out
550       a user command. Each command is a single word, optionally followed by
551       parameters specific to that command. Command and parameters are
552       space-delimited unless these notes specifically state otherwise. All
553       commands are case-insensitive. Parameters to commands may or may not be
554       case sensitive, depending on the command.
555
556       You can specify file names which have spaces in them by quoting the
557       name with double quotes, for example "a long file name".
558
559       Parameters shown in square brackets (e.g., "[parameter]") are optional.
560       If not given, the command will use suitable defaults. Parameters shown
561       in angle brackets (e.g., "<parameter>") are required.
562
563       Note that all commands operating on the server are actually performed
564       by issuing a request to the server. Thus the behavior may vary from
565       server to server, depending on how the server was implemented.
566
567       The commands available are given here in alphabetical order.
568
569       ? [command]
570           If command is specified, the ? command will display a brief
571           informative message about the specified command. If no command is
572           specified, a list of available commands will be displayed.
573
574       ! [shell command]
575           If shell command is specified, the ! command will execute a shell
576           locally and run the specified shell command. If no command is
577           specified, a local shell will be run.
578
579       allinfo file
580           The client will request that the server return all known
581           information about a file or directory (including streams).
582
583       altname file
584           The client will request that the server return the "alternate" name
585           (the 8.3 name) for a file or directory.
586
587       archive <number>
588           Sets the archive level when operating on files. 0 means ignore the
589           archive bit, 1 means only operate on files with this bit set, 2
590           means only operate on files with this bit set and reset it after
591           operation, 3 means operate on all files and reset it after
592           operation. The default is 0.
593
594       backup
595           Toggle the state of the "backup intent" flag sent to the server on
596           directory listings and file opens. If the "backup intent" flag is
597           true, the server will try and bypass some file system checks if the
598           user has been granted SE_BACKUP or SE_RESTORE privileges. This
599           state is useful when performing a backup or restore operation.
600
601       blocksize <number>
602           Sets the blocksize parameter for a tar operation. The default is
603           20. Causes tar file to be written out in blocksize*TBLOCK (normally
604           512 byte) units.
605
606       cancel jobid0 [jobid1] ... [jobidN]
607           The client will request that the server cancel the printjobs
608           identified by the given numeric print job ids.
609
610       case_sensitive
611           Toggles the setting of the flag in SMB packets that tells the
612           server to treat filenames as case sensitive. Set to OFF by default
613           (tells file server to treat filenames as case insensitive). Only
614           currently affects Samba 3.0.5 and above file servers with the case
615           sensitive parameter set to auto in the smb.conf.
616
617       cd <directory name>
618           If "directory name" is specified, the current working directory on
619           the server will be changed to the directory specified. This
620           operation will fail if for any reason the specified directory is
621           inaccessible.
622
623           If no directory name is specified, the current working directory on
624           the server will be reported.
625
626       chmod file mode in octal
627           This command depends on the server supporting the CIFS UNIX
628           extensions and will fail if the server does not. The client
629           requests that the server change the UNIX permissions to the given
630           octal mode, in standard UNIX format.
631
632       chown file uid gid
633           This command depends on the server supporting the CIFS UNIX
634           extensions and will fail if the server does not. The client
635           requests that the server change the UNIX user and group ownership
636           to the given decimal values. Note there is currently no way to
637           remotely look up the UNIX uid and gid values for a given name. This
638           may be addressed in future versions of the CIFS UNIX extensions.
639
640       close <fileid>
641           Closes a file explicitly opened by the open command. Used for
642           internal Samba testing purposes.
643
644       del <mask>
645           The client will request that the server attempt to delete all files
646           matching mask from the current working directory on the server.
647
648       deltree <mask>
649           The client will request that the server attempt to delete all files
650           and directories matching mask from the current working directory on
651           the server. Note this will recursively delete files and directories
652           within the directories selected even without the recurse command
653           being set. If any of the delete requests fail the command will stop
654           processing at that point, leaving files and directories not yet
655           processed untouched. This is by design.
656
657       dir <mask>
658           A list of the files matching mask in the current working directory
659           on the server will be retrieved from the server and displayed.
660
661       du <filename>
662           Does a directory listing and then prints out the current disk usage
663           and free space on a share.
664
665       echo <number> <data>
666           Does an SMBecho request to ping the server. Used for internal Samba
667           testing purposes.
668
669       exit
670           Terminate the connection with the server and exit from the program.
671
672       get <remote file name> [local file name]
673           Copy the file called remote file name from the server to the
674           machine running the client. If specified, name the local copy local
675           file name. Note that all transfers in smbclient are binary. See
676           also the lowercase command.
677
678       getfacl <filename>
679           Requires the server support the UNIX extensions. Requests and
680           prints the POSIX ACL on a file.
681
682       hardlink <src> <dest>
683           Creates a hardlink on the server using Windows CIFS semantics.
684
685       help [command]
686           See the ? command above.
687
688       history
689           Displays the command history.
690
691       iosize <bytes>
692           When sending or receiving files, smbclient uses an internal buffer
693           sized by the maximum number of allowed requests to the connected
694           server. This command allows this size to be set to any range
695           between 0 (which means use the default server controlled size)
696           bytes and 16776960 (0xFFFF00) bytes. Using the server controlled
697           size is the most efficient as smbclient will pipeline as many
698           simultaneous reads or writes needed to keep the server as busy as
699           possible. Setting this to any other size will slow down the
700           transfer.
701
702       lcd [directory name]
703           If directory name is specified, the current working directory on
704           the local machine will be changed to the directory specified. This
705           operation will fail if for any reason the specified directory is
706           inaccessible.
707
708           If no directory name is specified, the name of the current working
709           directory on the local machine will be reported.
710
711       link target linkname
712           This command depends on the server supporting the CIFS UNIX
713           extensions and will fail if the server does not. The client
714           requests that the server create a hard link between the linkname
715           and target files. The linkname file must not exist.
716
717       listconnect
718           Show the current connections held for DFS purposes.
719
720       lock <filenum> <r|w> <hex-start> <hex-len>
721           This command depends on the server supporting the CIFS UNIX
722           extensions and will fail if the server does not. Tries to set a
723           POSIX fcntl lock of the given type on the given range. Used for
724           internal Samba testing purposes.
725
726       logon <username> <password>
727           Establishes a new vuid for this session by logging on again.
728           Replaces the current vuid. Prints out the new vuid. Used for
729           internal Samba testing purposes.
730
731       logoff
732           Logs the user off the server, closing the session. Used for
733           internal Samba testing purposes.
734
735       lowercase
736           Toggle lowercasing of filenames for the get and mget commands.
737
738           When lowercasing is toggled ON, local filenames are converted to
739           lowercase when using the get and mget commands. This is often
740           useful when copying (say) MSDOS files from a server, because
741           lowercase filenames are the norm on UNIX systems.
742
743       ls <mask>
744           See the dir command above.
745
746       mask <mask>
747           This command allows the user to set up a mask which will be used
748           during recursive operation of the mget and mput commands.
749
750           The masks specified to the mget and mput commands act as filters
751           for directories rather than files when recursion is toggled ON.
752
753           The mask specified with the mask command is necessary to filter
754           files within those directories. For example, if the mask specified
755           in an mget command is "source*" and the mask specified with the
756           mask command is "*.c" and recursion is toggled ON, the mget command
757           will retrieve all files matching "*.c" in all directories below and
758           including all directories matching "source*" in the current working
759           directory.
760
761           Note that the value for mask defaults to blank (equivalent to "*")
762           and remains so until the mask command is used to change it. It
763           retains the most recently specified value indefinitely. To avoid
764           unexpected results it would be wise to change the value of mask
765           back to "*" after using the mget or mput commands.
766
767       md <directory name>
768           See the mkdir command.
769
770       mget <mask>
771           Copy all files matching mask from the server to the machine running
772           the client.
773
774           Note that mask is interpreted differently during recursive
775           operation and non-recursive operation - refer to the recurse and
776           mask commands for more information. Note that all transfers in
777           smbclient are binary. See also the lowercase command.
778
779       mkdir <directory name>
780           Create a new directory on the server (user access privileges
781           permitting) with the specified name.
782
783       more <file name>
784           Fetch a remote file and view it with the contents of your PAGER
785           environment variable.
786
787       mput <mask>
788           Copy all files matching mask in the current working directory on
789           the local machine to the current working directory on the server.
790
791           Note that mask is interpreted differently during recursive
792           operation and non-recursive operation - refer to the recurse and
793           mask commands for more information. Note that all transfers in
794           smbclient are binary.
795
796       notify <dir name>
797           Query a directory for change notifications. This command issues a
798           recursive filechangenotify call for all possible changes. As
799           changes come in will print one line per change. See
800           https://msdn.microsoft.com/en-us/library/dn392331.aspx for a
801           description of the action numbers that this command prints.
802
803           This command never ends, it waits for event indefinitely.
804
805       posix
806           Query the remote server to see if it supports the CIFS UNIX
807           extensions and prints out the list of capabilities supported. If
808           so, turn on POSIX pathname processing and large file read/writes
809           (if available),.
810
811       posix_encrypt <domain> <username> <password>
812           This command depends on the server supporting the CIFS UNIX
813           extensions and will fail if the server does not. Attempt to
814           negotiate SMB encryption on this connection. If smbclient connected
815           with kerberos credentials (-k) the arguments to this command are
816           ignored and the kerberos credentials are used to negotiate GSSAPI
817           signing and sealing instead. See also the -e option to smbclient to
818           force encryption on initial connection. This command is new with
819           Samba 3.2.
820
821       posix_open <filename> <octal mode>
822           This command depends on the server supporting the CIFS UNIX
823           extensions and will fail if the server does not. Opens a remote
824           file using the CIFS UNIX extensions and prints a fileid. Used for
825           internal Samba testing purposes.
826
827       posix_mkdir <directoryname> <octal mode>
828           This command depends on the server supporting the CIFS UNIX
829           extensions and will fail if the server does not. Creates a remote
830           directory using the CIFS UNIX extensions with the given mode.
831
832       posix_rmdir <directoryname>
833           This command depends on the server supporting the CIFS UNIX
834           extensions and will fail if the server does not. Deletes a remote
835           directory using the CIFS UNIX extensions.
836
837       posix_unlink <filename>
838           This command depends on the server supporting the CIFS UNIX
839           extensions and will fail if the server does not. Deletes a remote
840           file using the CIFS UNIX extensions.
841
842       posix_whoami
843           Query the remote server for the user token using the CIFS UNIX
844           extensions WHOAMI call. Prints out the guest status, user, group,
845           group list and sid list that the remote server is using on behalf
846           of the logged on user.
847
848       print <file name>
849           Print the specified file from the local machine through a printable
850           service on the server.
851
852       prompt
853           Toggle prompting for filenames during operation of the mget and
854           mput commands.
855
856           When toggled ON, the user will be prompted to confirm the transfer
857           of each file during these commands. When toggled OFF, all specified
858           files will be transferred without prompting.
859
860       put <local file name> [remote file name]
861           Copy the file called local file name from the machine running the
862           client to the server. If specified, name the remote copy remote
863           file name. Note that all transfers in smbclient are binary. See
864           also the lowercase command.
865
866       queue
867           Displays the print queue, showing the job id, name, size and
868           current status.
869
870       quit
871           See the exit command.
872
873       readlink symlinkname
874           This command depends on the server supporting the CIFS UNIX
875           extensions and will fail if the server does not. Print the value of
876           the symlink "symlinkname".
877
878       rd <directory name>
879           See the rmdir command.
880
881       recurse
882           Toggle directory recursion for the commands mget and mput.
883
884           When toggled ON, these commands will process all directories in the
885           source directory (i.e., the directory they are copying from ) and
886           will recurse into any that match the mask specified to the command.
887           Only files that match the mask specified using the mask command
888           will be retrieved. See also the mask command.
889
890           When recursion is toggled OFF, only files from the current working
891           directory on the source machine that match the mask specified to
892           the mget or mput commands will be copied, and any mask specified
893           using the mask command will be ignored.
894
895       rename <old filename> <new filename> [-f]
896           Rename files in the current working directory on the server from
897           old filename to new filename. The optional -f switch allows for
898           superseding the destination file, if it exists. This is supported
899           by NT1 protocol dialect and SMB2 protocol family.
900
901       rm <mask>
902           Remove all files matching mask from the current working directory
903           on the server.
904
905       rmdir <directory name>
906           Remove the specified directory (user access privileges permitting)
907           from the server.
908
909       scopy <source filename> <destination filename>
910           Attempt to copy a file on the server using the most efficient
911           server-side copy calls. Falls back to using read then write if
912           server doesn't support server-side copy.
913
914       setmode <filename> <perm=[+|\-]rsha>
915           A version of the DOS attrib command to set file permissions. For
916           example:
917
918           setmode myfile +r
919
920           would make myfile read only.
921
922       showconnect
923           Show the currently active connection held for DFS purposes.
924
925       stat file
926           This command depends on the server supporting the CIFS UNIX
927           extensions and will fail if the server does not. The client
928           requests the UNIX basic info level and prints out the same info
929           that the Linux stat command would about the file. This includes the
930           size, blocks used on disk, file type, permissions, inode number,
931           number of links and finally the three timestamps (access, modify
932           and change). If the file is a special file (symlink, character or
933           block device, fifo or socket) then extra information may also be
934           printed.
935
936       symlink target linkname
937           This command depends on the server supporting the CIFS UNIX
938           extensions and will fail if the server does not. The client
939           requests that the server create a symbolic hard link between the
940           target and linkname files. The linkname file must not exist. Note
941           that the server will not create a link to any path that lies
942           outside the currently connected share. This is enforced by the
943           Samba server.
944
945       tar <c|x>[IXbgNa]
946           Performs a tar operation - see the -T command line option above.
947           Behavior may be affected by the tarmode command (see below). Using
948           g (incremental) and N (newer) will affect tarmode settings. Note
949           that using the "-" option with tar x may not work - use the command
950           line option instead.
951
952       blocksize <blocksize>
953           Blocksize. Must be followed by a valid (greater than zero)
954           blocksize. Causes tar file to be written out in blocksize*TBLOCK
955           (512 byte) blocks.
956
957       tarmode
958       <full|inc|reset|noreset|system|nosystem|hidden|nohidden|verbose|noverbose>
959           Changes tar's behavior with regard to DOS attributes. There are 4
960           modes which can be turned on or off.
961
962           Incremental mode (default off). When off (using full) tar will back
963           up everything regardless of the archive bit setting. When on (using
964           inc), tar will only back up files with the archive bit set.
965
966           Reset mode (default off). When on (using reset), tar will remove
967           the archive bit on all files it backs up (implies read/write
968           share). Use noreset to turn off.
969
970           System mode (default on). When off, tar will not backup system
971           files. Use nosystem to turn off.
972
973           Hidden mode (default on). When off, tar will not backup hidden
974           files. Use nohidden to turn off.
975
976       timeout <per-operation timeout in seconds>
977           This allows the user to tune the default timeout used for each SMB
978           request. The default setting is 20 seconds. Increase it if requests
979           to the server sometimes time out. This can happen when SMB3
980           encryption is selected and smbclient is overwhelming the server
981           with requests.
982
983       unlock <filenum> <hex-start> <hex-len>
984           This command depends on the server supporting the CIFS UNIX
985           extensions and will fail if the server does not. Tries to unlock a
986           POSIX fcntl lock on the given range. Used for internal Samba
987           testing purposes.
988
989       volume
990           Prints the current volume name of the share.
991
992       vuid <number>
993           Changes the currently used vuid in the protocol to the given
994           arbitrary number. Without an argument prints out the current vuid
995           being used. Used for internal Samba testing purposes.
996
997       tcon <sharename>
998           Establishes a new tree connect (connection to a share). Replaces
999           the current tree connect. Prints the new tid (tree id). Used for
1000           internal Samba testing purposes.
1001
1002       tdis
1003           Close the current share connection (tree disconnect). Used for
1004           internal Samba testing purposes.
1005
1006       tid <number>
1007           Changes the current tree id (tid) in the protocol to a new
1008           arbitrary number. Without an argument, it prints out the tid
1009           currently used. Used for internal Samba testing purposes.
1010
1011       utimes <filename> <create time> <access time> <write time> < change
1012       time>
1013           Changes the timestamps on a file by name. Times should be specified
1014           in the format [YY]YY:MM:DD-HH:MM:SS or -1 for no change.
1015

NOTES

1017       Some servers are fussy about the case of supplied usernames, passwords,
1018       share names (AKA service names) and machine names. If you fail to
1019       connect try giving all parameters in uppercase.
1020
1021       It is often necessary to use the -n option when connecting to some
1022       types of servers. For example OS/2 LanManager insists on a valid
1023       NetBIOS name being used, so you need to supply a valid name that would
1024       be known to the server.
1025
1026       smbclient supports long file names where the server supports the
1027       LANMAN2 protocol or above.
1028

ENVIRONMENT VARIABLES

1030       See the --user and --password options for details on ways to specify a
1031       username and password via an environment variable.
1032

INSTALLATION

1034       The location of the client program is a matter for individual system
1035       administrators. The following are thus suggestions only.
1036
1037       It is recommended that the smbclient software be installed in the
1038       /usr/local/samba/bin/ or /usr/samba/bin/ directory, this directory
1039       readable by all, writeable only by root. The client program itself
1040       should be executable by all. The client should NOT be setuid or setgid!
1041
1042       The client log files should be put in a directory readable and
1043       writeable only by the user.
1044
1045       To test the client, you will need to know the name of a running
1046       SMB/CIFS server. It is possible to run smbd(8) as an ordinary user -
1047       running that server as a daemon on a user-accessible port (typically
1048       any port number over 1024) would provide a suitable test server.
1049

DIAGNOSTICS

1051       Most diagnostics issued by the client are logged in a specified log
1052       file. The log file name is specified at compile time, but may be
1053       overridden on the command line.
1054
1055       The number and nature of diagnostics available depends on the debug
1056       level used by the client. If you have problems, set the debug level to
1057       3 and peruse the log files.
1058

VERSION

1060       This man page is part of version 4.17.5 of the Samba suite.
1061

AUTHOR

1063       The original Samba software and related utilities were created by
1064       Andrew Tridgell. Samba is now developed by the Samba Team as an Open
1065       Source project similar to the way the Linux kernel is developed.
1066
1067
1068
1069Samba 4.17.5                      01/26/2023                      SMBCLIENT(1)
Impressum