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 [-b <buffer size>] [-d debuglevel] [-e] [-L <netbios name>]
10        [-U username] [-I destinationIP] [-M <netbios name>] [-m maxprotocol]
11        [-A authfile] [-N] [-C] [-g] [-i scope] [-O <socket options>]
12        [-p port] [-R <name resolve order>] [-s <smb config file>]
13        [-t <per-operation timeout in seconds>] [-k] [-P] [-c <command>]
14
15       smbclient {servicename} [password] [-b <buffer size>] [-d debuglevel]
16        [-e] [-D Directory] [-U username] [-W workgroup] [-M <netbios name>]
17        [-m maxprotocol] [-A authfile] [-N] [-C] [-g] [-l log-basename]
18        [-I destinationIP] [-E] [-c <command string>] [-i scope]
19        [-O <socket options>] [-p port] [-R <name resolve order>]
20        [-s <smb config file>] [-t <per-operation timeout in seconds>]
21        [-T<c|x>IXFqgbNan] [-k]
22

DESCRIPTION

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

OPTIONS

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

OPERATIONS

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

NOTES

937       Some servers are fussy about the case of supplied usernames, passwords,
938       share names (AKA service names) and machine names. If you fail to
939       connect try giving all parameters in uppercase.
940
941       It is often necessary to use the -n option when connecting to some
942       types of servers. For example OS/2 LanManager insists on a valid
943       NetBIOS name being used, so you need to supply a valid name that would
944       be known to the server.
945
946       smbclient supports long file names where the server supports the
947       LANMAN2 protocol or above.
948

ENVIRONMENT VARIABLES

950       The variable USER may contain the username of the person using the
951       client. This information is used only if the protocol level is high
952       enough to support session-level passwords.
953
954       The variable PASSWD may contain the password of the person using the
955       client. This information is used only if the protocol level is high
956       enough to support session-level passwords.
957

INSTALLATION

959       The location of the client program is a matter for individual system
960       administrators. The following are thus suggestions only.
961
962       It is recommended that the smbclient software be installed in the
963       /usr/local/samba/bin/ or /usr/samba/bin/ directory, this directory
964       readable by all, writeable only by root. The client program itself
965       should be executable by all. The client should NOT be setuid or setgid!
966
967       The client log files should be put in a directory readable and
968       writeable only by the user.
969
970       To test the client, you will need to know the name of a running
971       SMB/CIFS server. It is possible to run smbd(8) as an ordinary user -
972       running that server as a daemon on a user-accessible port (typically
973       any port number over 1024) would provide a suitable test server.
974

DIAGNOSTICS

976       Most diagnostics issued by the client are logged in a specified log
977       file. The log file name is specified at compile time, but may be
978       overridden on the command line.
979
980       The number and nature of diagnostics available depends on the debug
981       level used by the client. If you have problems, set the debug level to
982       3 and peruse the log files.
983

VERSION

985       This man page is part of version 4.9.1 of the Samba suite.
986

AUTHOR

988       The original Samba software and related utilities were created by
989       Andrew Tridgell. Samba is now developed by the Samba Team as an Open
990       Source project similar to the way the Linux kernel is developed.
991
992
993
994Samba 4.9.1                       05/11/2019                      SMBCLIENT(1)
Impressum