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 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 smb.conf for more information. The default
325           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 smb.conf file parameter (name resolve order) will be used.
382
383           The default order is lmhosts, host, wins, bcast. Without this
384           parameter or any entry in the name resolve order parameter of the
385           smb.conf file, the name resolution methods will be attempted in
386           this order.
387
388       -O|--socket-options=SOCKETOPTIONS
389           TCP socket options to set on the client socket. See the socket
390           options parameter in the smb.conf manual page for the list of valid
391           options.
392
393       -m|--max-protocol=MAXPROTOCOL
394           The value of the parameter (a string) is the highest protocol level
395           that will be supported by the client.
396
397           Note that specifying this parameter here will override the client
398           max protocol parameter in the smb.conf file.
399
400       -n|--netbiosname=NETBIOSNAME
401           This option allows you to override the NetBIOS name that Samba uses
402           for itself. This is identical to setting the netbios name parameter
403           in the smb.conf file. However, a command line setting will take
404           precedence over settings in smb.conf.
405
406       --netbios-scope=SCOPE
407           This specifies a NetBIOS scope that nmblookup will use to
408           communicate with when generating NetBIOS names. For details on the
409           use of NetBIOS scopes, see rfc1001.txt and rfc1002.txt. NetBIOS
410           scopes are very rarely used, only set this parameter if you are the
411           system administrator in charge of all the NetBIOS systems you
412           communicate with.
413
414       -W|--workgroup=WORKGROUP
415           Set the SMB domain of the username. This overrides the default
416           domain which is the domain defined in smb.conf. If the domain
417           specified is the same as the servers NetBIOS name, it causes the
418           client to log on using the servers local SAM (as opposed to the
419           Domain SAM).
420
421           Note that specifying this parameter here will override the
422           workgroup parameter in the smb.conf file.
423
424       -r|--realm=REALM
425           Set the realm for the domain.
426
427           Note that specifying this parameter here will override the realm
428           parameter in the smb.conf file.
429
430       -U|--user=[DOMAIN\]USERNAME[%PASSWORD]
431           Sets the SMB username or username and password.
432
433           If %PASSWORD is not specified, the user will be prompted. The
434           client will first check the USER environment variable (which is
435           also permitted to also contain the password seperated by a %), then
436           the LOGNAME variable (which is not permitted to contain a password)
437           and if either exists, the value is used. If these environmental
438           variables are not found, the username found in a Kerberos
439           Credentials cache may be used.
440
441           A third option is to use a credentials file which contains the
442           plaintext of the username and password. This option is mainly
443           provided for scripts where the admin does not wish to pass the
444           credentials on the command line or via environment variables. If
445           this method is used, make certain that the permissions on the file
446           restrict access from unwanted users. See the -A for more details.
447
448           Be cautious about including passwords in scripts or passing
449           user-supplied values onto the command line. For security it is
450           better to let the Samba client tool ask for the password if needed,
451           or obtain the password once with kinit.
452
453           While Samba will attempt to scrub the password from the process
454           title (as seen in ps), this is after startup and so is subject to a
455           race.
456
457       -N|--no-pass
458           If specified, this parameter suppresses the normal password prompt
459           from the client to the user. This is useful when accessing a
460           service that does not require a password.
461
462           Unless a password is specified on the command line or this
463           parameter is specified, the client will request a password.
464
465           If a password is specified on the command line and this option is
466           also defined the password on the command line will be silently
467           ignored and no password will be used.
468
469       --password
470           Specify the password on the commandline.
471
472           Be cautious about including passwords in scripts or passing
473           user-supplied values onto the command line. For security it is
474           better to let the Samba client tool ask for the password if needed,
475           or obtain the password once with kinit.
476
477           If --password is not specified, the tool will check the PASSWD
478           environment variable, followed by PASSWD_FD which is expected to
479           contain an open file descriptor (FD) number.
480
481           Finally it will check PASSWD_FILE (containing a file path to be
482           opened). The file should only contain the password. Make certain
483           that the permissions on the file restrict access from unwanted
484           users!
485
486           While Samba will attempt to scrub the password from the process
487           title (as seen in ps), this is after startup and so is subject to a
488           race.
489
490       --pw-nt-hash
491           The supplied password is the NT hash.
492
493       -A|--authentication-file=filename
494           This option allows you to specify a file from which to read the
495           username and password used in the connection. The format of the
496           file is:
497
498                                   username = <value>
499                                   password = <value>
500                                   domain   = <value>
501
502
503           Make certain that the permissions on the file restrict access from
504           unwanted users!
505
506       -P|--machine-pass
507           Use stored machine account password.
508
509       --simple-bind-dn=DN
510           DN to use for a simple bind.
511
512       --use-kerberos=desired|required|off
513           This parameter determines whether Samba client tools will try to
514           authenticate using Kerberos. For Kerberos authentication you need
515           to use dns names instead of IP addresses when connnecting to a
516           service.
517
518           Note that specifying this parameter here will override the client
519           use kerberos parameter in the smb.conf file.
520
521       --use-krb5-ccache=CCACHE
522           Specifies the credential cache location for Kerberos
523           authentication.
524
525           This will set --use-kerberos=required too.
526
527       --use-winbind-ccache
528           Try to use the credential cache by winbind.
529
530       --client-protection=sign|encrypt|off
531           Sets the connection protection the client tool should use.
532
533           Note that specifying this parameter here will override the client
534           protection parameter in the smb.conf file.
535
536           In case you need more fine grained control you can use:
537           --option=clientsmbencrypt=OPTION, --option=clientipcsigning=OPTION,
538           --option=clientsigning=OPTION.
539

OPERATIONS

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

NOTES

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

ENVIRONMENT VARIABLES

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

INSTALLATION

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

DIAGNOSTICS

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

VERSION

1059       This man page is part of version 4.16.2 of the Samba suite.
1060

AUTHOR

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