1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
3 <refentry id="smbclient.1">
6 <refentrytitle>smbclient</refentrytitle>
7 <manvolnum>1</manvolnum>
8 <refmiscinfo class="source">Samba</refmiscinfo>
9 <refmiscinfo class="manual">User Commands</refmiscinfo>
10 <refmiscinfo class="version">&doc.version;</refmiscinfo>
15 <refname>smbclient</refname>
16 <refpurpose>ftp-like client to access SMB/CIFS resources
17 on servers</refpurpose>
22 <command>smbclient</command>
23 <arg choice="opt">-M|--message=HOST</arg>
24 <arg choice="opt">-I|--ip-address=IP</arg>
25 <arg choice="opt">-E|--stderr</arg>
26 <arg choice="opt">-L|--list=HOST</arg>
27 <arg choice="opt">-T|--tar=<c|x>IXFvgbNan</arg>
28 <arg choice="opt">-D|--directory=DIR</arg>
29 <arg choice="opt">-b|--send-buffer=BYTES</arg>
30 <arg choice="opt">-t|--timeout=SECONDS</arg>
31 <arg choice="opt">-p|--port=PORT</arg>
32 <arg choice="opt">-g|--grepable</arg>
33 <arg choice="opt">-q|--quiet</arg>
34 <arg choice="opt">-B|--browse</arg>
35 <arg choice="opt">-?|--help</arg>
36 <arg choice="opt">--usage</arg>
37 <arg choice="opt">-d|--debuglevel=DEBUGLEVEL</arg>
38 <arg choice="opt">--debug-stdout</arg>
39 <arg choice="opt">-s|--configfile=CONFIGFILE</arg>
40 <arg choice="opt">--option=name=value</arg>
41 <arg choice="opt">-l|--log-basename=LOGFILEBASE</arg>
42 <arg choice="opt">--leak-report</arg>
43 <arg choice="opt">--leak-report-full</arg>
44 <arg choice="opt">-R|--name-resolve=NAME-RESOLVE-ORDER</arg>
45 <arg choice="opt">-O|--socket-options=SOCKETOPTIONS</arg>
46 <arg choice="opt">-m|--max-protocol=MAXPROTOCOL</arg>
47 <arg choice="opt">-n|--netbiosname=NETBIOSNAME</arg>
48 <arg choice="opt">--netbios-scope=SCOPE</arg>
49 <arg choice="opt">-W|--workgroup=WORKGROUP</arg>
50 <arg choice="opt">--realm=REALM</arg>
51 <arg choice="opt">-U|--user=[DOMAIN/]USERNAME%[PASSWORD]</arg>
52 <arg choice="opt">-N|--no-pass</arg>
53 <arg choice="opt">--password=STRING</arg>
54 <arg choice="opt">--pw-nt-hash</arg>
55 <arg choice="opt">-A|--authentication-file=FILE</arg>
56 <arg choice="opt">-P|--machine-pass</arg>
57 <arg choice="opt">--simple-bind-dn=DN</arg>
58 <arg choice="opt">--use-kerberos=desired|required|off</arg>
59 <arg choice="opt">--use-krb5-ccache=CCACHE</arg>
60 <arg choice="opt">--use-winbind-ccache</arg>
61 <arg choice="opt">--client-protection=sign|encrypt|off</arg>
62 <arg choice="opt">-V|--version</arg>
63 <arg choice="opt">-c|--command=STRING</arg>
68 <title>DESCRIPTION</title>
70 <para>This tool is part of the <citerefentry><refentrytitle>samba</refentrytitle>
71 <manvolnum>7</manvolnum></citerefentry> suite.</para>
73 <para><command>smbclient</command> is a client that can
74 'talk' to an SMB/CIFS server. It offers an interface
75 similar to that of the ftp program (see <citerefentry><refentrytitle>ftp</refentrytitle>
76 <manvolnum>1</manvolnum></citerefentry>).
77 Operations include things like getting files from the server
78 to the local machine, putting files from the local machine to
79 the server, retrieving directory information from the server
85 <title>OPTIONS</title>
89 <term>servicename</term>
90 <listitem><para>servicename is the name of the service
91 you want to use on the server. A service name takes the form
92 <filename>//server/service</filename> where <parameter>server
93 </parameter> is the NetBIOS name of the SMB/CIFS server
94 offering the desired service and <parameter>service</parameter>
95 is the name of the service offered. Thus to connect to
96 the service "printer" on the SMB/CIFS server "smbserver",
97 you would use the servicename <filename>//smbserver/printer
100 <para>Note that the server name required is NOT necessarily
101 the IP (DNS) host name of the server ! The name required is
102 a NetBIOS server name, which may or may not be the
103 same as the IP hostname of the machine running the server.
106 <para>The server name is looked up according to either
107 the <parameter>-R|--name-resolve</parameter> parameter to <command>smbclient</command> or
108 using the name resolve order parameter in
109 the <citerefentry><refentrytitle>smb.conf</refentrytitle>
110 <manvolnum>5</manvolnum></citerefentry> file,
111 allowing an administrator to change the order and methods
112 by which server names are looked up. </para></listitem>
116 <term>password</term>
117 <listitem><para>The password required to access the specified
118 service on the specified server. If this parameter is
119 supplied, the <parameter>-N</parameter> option (suppress
120 password prompt) is assumed. </para>
122 <para>There is no default password. If no password is supplied
123 on the command line (either by using this parameter or adding
124 a password to the <parameter>-U</parameter> option (see
125 below)) and the <parameter>-N</parameter> option is not
126 specified, the client will prompt for a password, even if
127 the desired service does not require one. (If no password is
128 required, simply press ENTER to provide a null password.)
131 <para>Note: Some servers (including OS/2 and Windows for
132 Workgroups) insist on an uppercase password. Lowercase
133 or mixed case passwords may be rejected by these servers.
136 <para>Be cautious about including passwords in scripts.
141 <term>-M|--message NetBIOS name</term>
142 <listitem><para>This options allows you to send messages, using
143 the "WinPopup" protocol, to another computer. Once a connection is
144 established you then type your message, pressing ^D (control-D) to
147 <para>If the receiving computer is running WinPopup the user will
148 receive the message and probably a beep. If they are not running
149 WinPopup the message will be lost, and no error message will
152 <para>The message is also automatically truncated if the message
153 is over 1600 bytes, as this is the limit of the protocol.
157 One useful trick is to pipe the message through <command>smbclient</command>.
158 For example: smbclient -M FRED < mymessage.txt will send the
159 message in the file <filename>mymessage.txt</filename> to the
163 <para>You may also find the <parameter>-U</parameter> and
164 <parameter>-I</parameter> options useful, as they allow you to
165 control the FROM and TO parts of the message. </para>
167 <para>See the <parameter>message command</parameter> parameter in the <citerefentry><refentrytitle>smb.conf</refentrytitle>
168 <manvolnum>5</manvolnum></citerefentry> for a description of how to handle incoming
169 WinPopup messages in Samba. </para>
171 <para><emphasis>Note</emphasis>: Copy WinPopup into the startup group
172 on your WfWg PCs if you want them to always be able to receive
173 messages. </para></listitem>
177 <term>-p|--port port</term>
178 <listitem><para>This number is the TCP port number that will be used
179 when making connections to the server. The standard (well-known)
180 TCP port number for an SMB/CIFS server is 139, which is the
181 default. </para></listitem>
185 <term>-g|--grepable</term>
186 <listitem><para>This parameter provides combined with
187 <parameter>-L</parameter> easy parseable output that allows processing
188 with utilities such as grep and cut.
193 <term>-m|--max-protocol protocol</term>
194 <listitem><para>This allows the user to select the
195 highest SMB protocol level that smbclient will use to
196 connect to the server. By default this is set to
197 highest available SMB3 protocol version.
198 To connect using SMB2 or SMB1 protocol, use the
199 strings SMB2 or NT1 respectively. Note that to connect
200 to a Windows 2012 server with encrypted transport selecting
201 a max-protocol of SMB3 is required.
206 <term>-P|--machine-pass</term>
208 Make queries to the external server using the machine account of the local server.
213 <term>-I|--ip-address IP-address</term>
214 <listitem><para><replaceable>IP address</replaceable> is the address of the server to connect to.
215 It should be specified in standard "a.b.c.d" notation. </para>
217 <para>Normally the client would attempt to locate a named
218 SMB/CIFS server by looking it up via the NetBIOS name resolution
219 mechanism described above in the <parameter>name resolve order</parameter>
220 parameter above. Using this parameter will force the client
221 to assume that the server is on the machine with the specified IP
222 address and the NetBIOS name component of the resource being
223 connected to will be ignored. </para>
225 <para>There is no default for this parameter. If not supplied,
226 it will be determined automatically by the client as described
227 above. </para></listitem>
231 <term>-E|--stderr</term>
232 <listitem><para>This parameter causes the client to write messages
233 to the standard error stream (stderr) rather than to the standard
234 output stream. </para>
236 <para>By default, the client writes messages to standard output
237 - typically the user's tty. </para></listitem>
241 <term>-L|--list</term>
242 <listitem><para>This option allows you to look at what services
243 are available on a server. You use it as <command>smbclient -L
244 host</command> and a list should appear. The <parameter>-I
245 </parameter> option may be useful if your NetBIOS names don't
246 match your TCP/IP DNS host names or if you are trying to reach a
247 host on another network. </para></listitem>
251 <term>-b|--send-buffer buffersize</term>
253 When sending or receiving files, smbclient uses an
254 internal buffer sized by the maximum number of allowed requests
255 to the connected server. This command allows this size to be set to any
256 range between 0 (which means use the default server controlled size) bytes
257 and 16776960 (0xFFFF00) bytes. Using the server controlled size is the
258 most efficient as smbclient will pipeline as many simultaneous reads or
259 writes needed to keep the server as busy as possible. Setting this to
260 any other size will slow down the transfer. This can also be set
261 using the <command>iosize</command> command inside smbclient.
266 <term>-B|--browse</term>
267 <listitem><para>Browse SMB servers using DNS.</para>
272 <term>-t|--timeout <timeout-seconds></term>
273 <listitem><para>This allows the user to tune the default
274 timeout used for each SMB request. The default setting is
275 20 seconds. Increase it if requests to the server sometimes
276 time out. This can happen when SMB3 encryption is selected
277 and smbclient is overwhelming the server with requests.
278 This can also be set using the <command>timeout</command>
279 command inside smbclient.
284 <term>-T|--tar tar options</term>
285 <listitem><para>smbclient may be used to create <command>tar(1)
286 </command> compatible backups of all the files on an SMB/CIFS
287 share. The secondary tar flags that can be given to this option
291 <listitem><para><parameter>c</parameter> - Create a tar
292 backup archive on the local system. Must be followed by
293 the name of a tar file, tape device or "-" for standard
294 output. If using standard output you must turn the log
295 level to its lowest value -d0 to avoid corrupting your tar
296 file. This flag is mutually exclusive with the
297 <parameter>x</parameter> flag. </para></listitem>
299 <listitem><para><parameter>n</parameter> - In
300 combination with the <parameter>c</parameter>
301 flag, do not actually create the archive,
302 instead perform a dry run that attempts
303 everything that involved in creation other than
304 writing the file.</para></listitem>
306 <listitem><para><parameter>x</parameter> - Extract (restore) a local
307 tar file back to a share. Unless the -D option is given, the tar
308 files will be restored from the top level of the share. Must be
309 followed by the name of the tar file, device or "-" for standard
310 input. Mutually exclusive with the <parameter>c</parameter> flag.
311 Restored files have their creation times (mtime) set to the
312 date saved in the tar file. Directories currently do not get
313 their creation dates restored properly. </para></listitem>
315 <listitem><para><parameter>I</parameter> - Include files and directories.
316 Is the default behavior when filenames are specified above. Causes
317 files to be included in an extract or create (and therefore
318 everything else to be excluded). See example below. Filename globbing
319 works in one of two ways. See <parameter>r</parameter> below. </para></listitem>
321 <listitem><para><parameter>X</parameter> - Exclude files and directories.
322 Causes files to be excluded from an extract or create. See
323 example below. Filename globbing works in one of two ways.
324 See <parameter>r</parameter> below. </para></listitem>
326 <listitem><para><parameter>F</parameter> - File containing a list of files and directories.
327 The <parameter>F</parameter> causes the name following the tarfile to
328 create to be read as a filename that contains a list of files and directories to
329 be included in an extract or create (and therefore everything else to be excluded).
330 See example below. Filename globbing works in one of two ways.
331 See <parameter>r</parameter> below.
334 <listitem><para><parameter>b</parameter> - Blocksize. Must be followed
335 by a valid (greater than zero) blocksize. Causes tar file to be
336 written out in blocksize*TBLOCK (512 byte) blocks.
339 <listitem><para><parameter>g</parameter> - Incremental. Only back up
340 files that have the archive bit set. Useful only with the
341 <parameter>c</parameter> flag. </para></listitem>
343 <listitem><para><parameter>v</parameter> - Verbose. Makes tar
344 print out the files being processed. By default tar is not verbose.
345 This is the same as tarmode verbose.
348 <listitem><para><parameter>r</parameter> - Use wildcard
349 matching to include or exclude. Deprecated.
352 <listitem><para><parameter>N</parameter> - Newer than. Must be followed
353 by the name of a file whose date is compared against files found
354 on the share during a create. Only files newer than the file
355 specified are backed up to the tar file. Useful only with the
356 <parameter>c</parameter> flag. </para></listitem>
358 <listitem><para><parameter>a</parameter> - Set archive bit. Causes the
359 archive bit to be reset when a file is backed up. Useful with the
360 <parameter>g</parameter> and <parameter>c</parameter> flags.
365 <para><emphasis>Tar Long File Names</emphasis></para>
367 <para><command>smbclient</command>'s tar option now supports long
368 file names both on backup and restore. However, the full path
369 name of the file must be less than 1024 bytes. Also, when
370 a tar archive is created, <command>smbclient</command>'s tar option places all
371 files in the archive with relative names, not absolute names.
374 <para><emphasis>Tar Filenames</emphasis></para>
376 <para>All file names can be given as DOS path names (with '\\'
377 as the component separator) or as UNIX path names (with '/' as
378 the component separator). </para>
380 <para><emphasis>Examples</emphasis></para>
382 <para>Restore from tar file <filename>backup.tar</filename> into myshare on mypc
383 (no password on share). </para>
385 <para><command>smbclient //mypc/myshare "" -N -Tx backup.tar
388 <para>Restore everything except <filename>users/docs</filename>
391 <para><command>smbclient //mypc/myshare "" -N -TXx backup.tar
392 users/docs</command></para>
394 <para>Create a tar file of the files beneath <filename>
395 users/docs</filename>. </para>
397 <para><command>smbclient //mypc/myshare "" -N -Tc
398 backup.tar users/docs </command></para>
400 <para>Create the same tar file as above, but now use
401 a DOS path name. </para>
403 <para><command>smbclient //mypc/myshare "" -N -Tc backup.tar
404 users\edocs </command></para>
406 <para>Create a tar file of the files listed in the file <filename>tarlist</filename>.</para>
408 <para><command>smbclient //mypc/myshare "" -N -TcF
409 backup.tar tarlist</command></para>
411 <para>Create a tar file of all the files and directories in
414 <para><command>smbclient //mypc/myshare "" -N -Tc backup.tar *
420 <term>-D|--directory initial directory</term>
421 <listitem><para>Change to initial directory before starting. Probably
422 only of any use with the tar -T option. </para></listitem>
426 <term>-c|--command command string</term>
427 <listitem><para>command string is a semicolon-separated list of
428 commands to be executed instead of prompting from stdin. <parameter>
429 -N</parameter> is implied by <parameter>-c</parameter>.</para>
431 <para>This is particularly useful in scripts and for printing stdin
432 to the server, e.g. <command>-c 'print -'</command>. </para></listitem>
436 &cmdline.common.samba.client;
437 &cmdline.common.connection;
438 &cmdline.common.credentials;
444 <title>OPERATIONS</title>
446 <para>Once the client is running, the user is presented with
449 <para><prompt>smb:\> </prompt></para>
451 <para>The backslash ("\\") indicates the current working directory
452 on the server, and will change if the current working directory
455 <para>The prompt indicates that the client is ready and waiting to
456 carry out a user command. Each command is a single word, optionally
457 followed by parameters specific to that command. Command and parameters
458 are space-delimited unless these notes specifically
459 state otherwise. All commands are case-insensitive. Parameters to
460 commands may or may not be case sensitive, depending on the command.
463 <para>You can specify file names which have spaces in them by quoting
464 the name with double quotes, for example "a long file name". </para>
466 <para>Parameters shown in square brackets (e.g., "[parameter]") are
467 optional. If not given, the command will use suitable defaults. Parameters
468 shown in angle brackets (e.g., "<parameter>") are required.
472 <para>Note that all commands operating on the server are actually
473 performed by issuing a request to the server. Thus the behavior may
474 vary from server to server, depending on how the server was implemented.
477 <para>The commands available are given here in alphabetical order. </para>
481 <term>? [command]</term>
482 <listitem><para>If <replaceable>command</replaceable> is specified, the ? command will display
483 a brief informative message about the specified command. If no
484 command is specified, a list of available commands will
485 be displayed. </para></listitem>
489 <term>! [shell command]</term>
490 <listitem><para>If <replaceable>shell command</replaceable> is specified, the !
491 command will execute a shell locally and run the specified shell
492 command. If no command is specified, a local shell will be run.
497 <term>allinfo file</term>
498 <listitem><para>The client will request that the server return
499 all known information about a file or directory (including streams).
504 <term>altname file</term>
505 <listitem><para>The client will request that the server return
506 the "alternate" name (the 8.3 name) for a file or directory.
511 <term>archive <number></term>
512 <listitem><para>Sets the archive level when operating on files.
513 0 means ignore the archive bit, 1 means only operate on files with this bit set,
514 2 means only operate on files with this bit set and reset it after operation,
515 3 means operate on all files and reset it after operation. The default is 0.
521 <listitem><para>Toggle the state of the "backup intent" flag
522 sent to the server on directory listings and file opens. If
523 the "backup intent" flag is true, the server will try and
524 bypass some file system checks if the user has been granted
525 SE_BACKUP or SE_RESTORE privileges. This state is useful when
526 performing a backup or restore operation.
531 <term>blocksize <number></term>
532 <listitem><para>Sets the blocksize parameter for a tar operation. The default is 20.
533 Causes tar file to be written out in blocksize*TBLOCK (normally 512 byte) units.
538 <term>cancel jobid0 [jobid1] ... [jobidN]</term>
539 <listitem><para>The client will request that the server cancel
540 the printjobs identified by the given numeric print job ids.
545 <term>case_sensitive</term>
546 <listitem><para>Toggles the setting of the flag in SMB packets that
547 tells the server to treat filenames as case sensitive. Set to OFF by
548 default (tells file server to treat filenames as case insensitive). Only
549 currently affects Samba 3.0.5 and above file servers with the case sensitive
550 parameter set to auto in the smb.conf.
555 <term>cd <directory name></term>
556 <listitem><para>If "directory name" is specified, the current
557 working directory on the server will be changed to the directory
558 specified. This operation will fail if for any reason the specified
559 directory is inaccessible. </para>
561 <para>If no directory name is specified, the current working
562 directory on the server will be reported. </para></listitem>
566 <term>chmod file mode in octal</term>
567 <listitem><para>This command depends on the server supporting the CIFS
568 UNIX extensions and will fail if the server does not. The client requests that the server
569 change the UNIX permissions to the given octal mode, in standard UNIX format.
574 <term>chown file uid gid</term>
575 <listitem><para>This command depends on the server supporting the CIFS
576 UNIX extensions and will fail if the server does not. The client requests that the server
577 change the UNIX user and group ownership to the given decimal values. Note there is
578 currently no way to remotely look up the UNIX uid and gid values for a given name.
579 This may be addressed in future versions of the CIFS UNIX extensions.
584 <term>close <fileid></term>
585 <listitem><para>Closes a file explicitly opened by the open command. Used for
586 internal Samba testing purposes.
591 <term>del <mask></term>
592 <listitem><para>The client will request that the server attempt
593 to delete all files matching <replaceable>mask</replaceable> from the current working
594 directory on the server. </para></listitem>
598 <term>deltree <mask></term>
599 <listitem><para>The client will request that the server attempt
600 to delete all files and directories matching <replaceable>mask</replaceable> from the current working
601 directory on the server. Note this will recursively delete files and directories within
602 the directories selected even without the recurse command being set. If any of the delete
603 requests fail the command will stop processing at that point, leaving files and directories
604 not yet processed untouched. This is by design.</para></listitem>
608 <term>dir <mask></term>
609 <listitem><para>A list of the files matching <replaceable>mask</replaceable> in the current
610 working directory on the server will be retrieved from the server
611 and displayed. </para></listitem>
615 <term>du <filename></term>
616 <listitem><para>Does a directory listing and then prints out the current disk usage and free space on a share.
621 <term>echo <number> <data></term>
622 <listitem><para>Does an SMBecho request to ping the server. Used for internal Samba testing purposes.
628 <listitem><para>Terminate the connection with the server and exit
629 from the program. </para></listitem>
633 <term>get <remote file name> [local file name]</term>
634 <listitem><para>Copy the file called <filename>remote file name</filename> from
635 the server to the machine running the client. If specified, name
636 the local copy <filename>local file name</filename>. Note that all transfers in
637 <command>smbclient</command> are binary. See also the
638 lowercase command. </para></listitem>
642 <term>getfacl <filename></term>
643 <listitem><para>Requires the server support the UNIX extensions. Requests and prints
644 the POSIX ACL on a file.
649 <term>hardlink <src> <dest></term>
650 <listitem><para>Creates a hardlink on the server using Windows CIFS semantics.
655 <term>help [command]</term>
656 <listitem><para>See the ? command above. </para></listitem>
660 <term>history</term> <listitem><para>Displays the command history.</para></listitem>
664 <term>iosize <bytes></term>
666 When sending or receiving files, smbclient uses an
667 internal buffer sized by the maximum number of allowed requests
668 to the connected server. This command allows this size to be set to any
669 range between 0 (which means use the default server controlled size) bytes
670 and 16776960 (0xFFFF00) bytes. Using the server controlled size is the
671 most efficient as smbclient will pipeline as many simultaneous reads or
672 writes needed to keep the server as busy as possible. Setting this to
673 any other size will slow down the transfer.
678 <term>lcd [directory name]</term>
679 <listitem><para>If <replaceable>directory name</replaceable> is specified, the current
680 working directory on the local machine will be changed to
681 the directory specified. This operation will fail if for any
682 reason the specified directory is inaccessible. </para>
684 <para>If no directory name is specified, the name of the
685 current working directory on the local machine will be reported.
690 <term>link target linkname</term>
691 <listitem><para>This command depends on the server supporting the CIFS
692 UNIX extensions and will fail if the server does not. The client requests that the server
693 create a hard link between the linkname and target files. The linkname file
699 <term>listconnect</term>
700 <listitem><para>Show the current connections held for DFS purposes.
705 <term>lock <filenum> <r|w> <hex-start> <hex-len></term>
706 <listitem><para>This command depends on the server supporting the CIFS
707 UNIX extensions and will fail if the server does not. Tries to set a POSIX
708 fcntl lock of the given type on the given range. Used for internal Samba testing purposes.
713 <term>logon <username> <password></term>
714 <listitem><para>Establishes a new vuid for this session by logging on again.
715 Replaces the current vuid. Prints out the new vuid. Used for internal Samba testing purposes.
721 <listitem><para>Logs the user off the server, closing the session.
722 Used for internal Samba testing purposes.
727 <term>lowercase</term>
728 <listitem><para>Toggle lowercasing of filenames for the get and
732 <para>When lowercasing is toggled ON, local filenames are converted
733 to lowercase when using the get and mget commands. This is
734 often useful when copying (say) MSDOS files from a server, because
735 lowercase filenames are the norm on UNIX systems. </para></listitem>
739 <term>ls <mask></term>
740 <listitem><para>See the dir command above. </para></listitem>
744 <term>mask <mask></term>
745 <listitem><para>This command allows the user to set up a mask
746 which will be used during recursive operation of the mget and
747 mput commands. </para>
749 <para>The masks specified to the mget and mput commands act as
750 filters for directories rather than files when recursion is
753 <para>The mask specified with the mask command is necessary
754 to filter files within those directories. For example, if the
755 mask specified in an mget command is "source*" and the mask
756 specified with the mask command is "*.c" and recursion is
757 toggled ON, the mget command will retrieve all files matching
758 "*.c" in all directories below and including all directories
759 matching "source*" in the current working directory. </para>
761 <para>Note that the value for mask defaults to blank (equivalent
762 to "*") and remains so until the mask command is used to change it.
763 It retains the most recently specified value indefinitely. To
764 avoid unexpected results it would be wise to change the value of
765 mask back to "*" after using the mget or mput commands. </para></listitem>
769 <term>md <directory name></term>
770 <listitem><para>See the mkdir command. </para></listitem>
774 <term>mget <mask></term>
775 <listitem><para>Copy all files matching <replaceable>mask</replaceable> from the server to
776 the machine running the client. </para>
778 <para>Note that <replaceable>mask</replaceable> is interpreted differently during recursive
779 operation and non-recursive operation - refer to the recurse and
780 mask commands for more information. Note that all transfers in
781 <command>smbclient</command> are binary. See also the lowercase command. </para></listitem>
785 <term>mkdir <directory name></term>
786 <listitem><para>Create a new directory on the server (user access
787 privileges permitting) with the specified name. </para></listitem>
791 <term>more <file name></term>
792 <listitem><para>Fetch a remote file and view it with the contents
793 of your PAGER environment variable.
798 <term>mput <mask></term>
799 <listitem><para>Copy all files matching <replaceable>mask</replaceable> in the current working
800 directory on the local machine to the current working directory on
803 <para>Note that <replaceable>mask</replaceable> is interpreted differently during recursive
804 operation and non-recursive operation - refer to the recurse and mask
805 commands for more information. Note that all transfers in <command>smbclient</command>
806 are binary. </para></listitem>
810 <term>notify <dir name></term>
811 <listitem><para>Query a directory for change
812 notifications. This command issues a recursive
813 filechangenotify call for all possible changes. As
814 changes come in will print one line per change. See
815 <ulink url="https://msdn.microsoft.com/en-us/library/dn392331.aspx">https://msdn.microsoft.com/en-us/library/dn392331.aspx</ulink>
816 for a description of the action numbers that this
817 command prints.</para>
818 <para>This command never ends, it waits for event
825 <listitem><para>Query the remote server to see if it supports the CIFS UNIX
826 extensions and prints out the list of capabilities supported. If so, turn
827 on POSIX pathname processing and large file read/writes (if available),.
832 <term>posix_encrypt <domain> <username> <password></term>
833 <listitem><para>This command depends on the server supporting the CIFS
834 UNIX extensions and will fail if the server does not. Attempt to negotiate
835 SMB encryption on this connection. If smbclient connected with kerberos
836 credentials (-k) the arguments to this command are ignored and the kerberos
837 credentials are used to negotiate GSSAPI signing and sealing instead. See
838 also the -e option to smbclient to force encryption on initial connection.
839 This command is new with Samba 3.2.
844 <term>posix_open <filename> <octal mode></term>
845 <listitem><para>This command depends on the server supporting the CIFS
846 UNIX extensions and will fail if the server does not. Opens a remote file
847 using the CIFS UNIX extensions and prints a fileid. Used for internal Samba
853 <term>posix_mkdir <directoryname> <octal mode></term>
854 <listitem><para>This command depends on the server supporting the CIFS
855 UNIX extensions and will fail if the server does not. Creates a remote directory
856 using the CIFS UNIX extensions with the given mode.
861 <term>posix_rmdir <directoryname></term>
862 <listitem><para>This command depends on the server supporting the CIFS
863 UNIX extensions and will fail if the server does not. Deletes a remote directory
864 using the CIFS UNIX extensions.
869 <term>posix_unlink <filename></term>
870 <listitem><para>This command depends on the server supporting the CIFS
871 UNIX extensions and will fail if the server does not. Deletes a remote file
872 using the CIFS UNIX extensions.
877 <term>posix_whoami</term>
878 <listitem><para>Query the remote server for the user token using the CIFS UNIX
879 extensions WHOAMI call. Prints out the guest status, user, group, group list and
880 sid list that the remote server is using on behalf of the logged on user.
885 <term>print <file name></term>
886 <listitem><para>Print the specified file from the local machine
887 through a printable service on the server. </para></listitem>
892 <listitem><para>Toggle prompting for filenames during operation
893 of the mget and mput commands. </para>
895 <para>When toggled ON, the user will be prompted to confirm
896 the transfer of each file during these commands. When toggled
897 OFF, all specified files will be transferred without prompting.
902 <term>put <local file name> [remote file name]</term>
903 <listitem><para>Copy the file called <filename>local file name</filename> from the
904 machine running the client to the server. If specified,
905 name the remote copy <filename>remote file name</filename>. Note that all transfers
906 in <command>smbclient</command> are binary. See also the lowercase command.
912 <listitem><para>Displays the print queue, showing the job id,
913 name, size and current status. </para></listitem>
918 <listitem><para>See the exit command. </para></listitem>
922 <term>readlink symlinkname</term>
923 <listitem><para>This command depends on the server supporting the CIFS
924 UNIX extensions and will fail if the server does not. Print
925 the value of the symlink "symlinkname".
930 <term>rd <directory name></term>
931 <listitem><para>See the rmdir command. </para></listitem>
936 <listitem><para>Toggle directory recursion for the commands mget
939 <para>When toggled ON, these commands will process all directories
940 in the source directory (i.e., the directory they are copying
941 from ) and will recurse into any that match the mask specified
942 to the command. Only files that match the mask specified using
943 the mask command will be retrieved. See also the mask command.
946 <para>When recursion is toggled OFF, only files from the current
947 working directory on the source machine that match the mask specified
948 to the mget or mput commands will be copied, and any mask specified
949 using the mask command will be ignored. </para></listitem>
953 <term>rename <old filename> <new filename> [-f]</term>
954 <listitem><para>Rename files in the current working directory on the
955 server from <replaceable>old filename</replaceable> to
956 <replaceable>new filename</replaceable>. The optional
957 -f switch allows for superseding the destination file,
958 if it exists. This is supported by NT1 protocol dialect
959 and SMB2 protocol family.</para></listitem>
963 <term>rm <mask></term>
964 <listitem><para>Remove all files matching <replaceable>mask</replaceable> from the current
965 working directory on the server. </para></listitem>
969 <term>rmdir <directory name></term>
970 <listitem><para>Remove the specified directory (user access
971 privileges permitting) from the server. </para></listitem>
975 <term>scopy <source filename> <destination filename></term>
976 <listitem><para>Attempt to copy a file on the server using the
977 most efficient server-side copy calls. Falls back to using
978 read then write if server doesn't support server-side copy.
983 <term>setmode <filename> <perm=[+|\-]rsha></term>
984 <listitem><para>A version of the DOS attrib command to set
985 file permissions. For example: </para>
987 <para><command>setmode myfile +r </command></para>
989 <para>would make myfile read only. </para></listitem>
993 <term>showconnect</term>
994 <listitem><para>Show the currently active connection held for DFS purposes.
999 <term>stat file</term>
1000 <listitem><para>This command depends on the server supporting the CIFS
1001 UNIX extensions and will fail if the server does not. The client requests the
1002 UNIX basic info level and prints out the same info that the Linux stat command
1003 would about the file. This includes the size, blocks used on disk, file type,
1004 permissions, inode number, number of links and finally the three timestamps
1005 (access, modify and change). If the file is a special file (symlink, character or
1006 block device, fifo or socket) then extra information may also be printed.
1011 <term>symlink target linkname</term>
1012 <listitem><para>This command depends on the server supporting the CIFS
1013 UNIX extensions and will fail if the server does not. The client requests that the server
1014 create a symbolic hard link between the target and linkname files. The linkname file
1015 must not exist. Note that the server will not create a link to any path that lies
1016 outside the currently connected share. This is enforced by the Samba server.
1021 <term>tar <c|x>[IXbgNa]</term>
1022 <listitem><para>Performs a tar operation - see the
1023 <parameter>-T</parameter> command line option above. Behavior
1024 may be affected by the tarmode command (see below). Using g
1025 (incremental) and N (newer) will affect tarmode settings. Note
1026 that using the "-" option with tar x may not work - use the
1027 command line option instead.</para></listitem>
1031 <term>blocksize <blocksize></term>
1032 <listitem><para>Blocksize. Must be followed by a valid (greater
1033 than zero) blocksize. Causes tar file to be written out in
1034 <replaceable>blocksize</replaceable>*TBLOCK (512 byte) blocks. </para></listitem>
1038 <term>tarmode <full|inc|reset|noreset|system|nosystem|hidden|nohidden|verbose|noverbose></term>
1039 <listitem><para>Changes tar's behavior with regard to DOS
1040 attributes. There are 4 modes which can be turned on or
1043 <para>Incremental mode (default off). When off (using
1044 <command>full</command>) tar will back up everything
1045 regardless of the <emphasis>archive</emphasis> bit
1046 setting. When on (using <command>inc</command>), tar will only
1047 back up files with the archive bit set.</para>
1049 <para>Reset mode (default off). When on (using
1050 <command>reset</command>), tar will remove the archive bit on
1051 all files it backs up (implies read/write share). Use
1052 <command>noreset</command> to turn off.</para>
1054 <para>System mode (default on). When off, tar will not backup
1055 system files. Use <command>nosystem</command> to turn off.</para>
1057 <para>Hidden mode (default on). When off, tar will not backup
1058 hidden files. Use <command>nohidden</command> to turn off.</para>
1063 <term>timeout <per-operation timeout in seconds></term>
1064 <listitem><para>This allows the user to tune the default
1065 timeout used for each SMB request. The default setting is
1066 20 seconds. Increase it if requests to the server sometimes
1067 time out. This can happen when SMB3 encryption is selected
1068 and smbclient is overwhelming the server with requests.
1073 <term>unlock <filenum> <hex-start> <hex-len></term>
1074 <listitem><para>This command depends on the server supporting the CIFS
1075 UNIX extensions and will fail if the server does not. Tries to unlock a POSIX
1076 fcntl lock on the given range. Used for internal Samba testing purposes.
1082 <listitem><para>Prints the current volume name of the share.
1087 <term>vuid <number></term>
1088 <listitem><para>Changes the currently used vuid in the protocol to
1089 the given arbitrary number. Without an argument prints out the current
1090 vuid being used. Used for internal Samba testing purposes.
1095 <term>tcon <sharename></term>
1096 <listitem><para>Establishes a new tree connect (connection to a share).
1097 Replaces the current tree connect. Prints the new tid (tree id).
1098 Used for internal Samba testing purposes.
1104 <listitem><para>Close the current share connection (tree disconnect).
1105 Used for internal Samba testing purposes.
1110 <term>tid <number></term>
1111 <listitem><para>Changes the current tree id (tid) in the
1112 protocol to a new arbitrary number. Without an argument, it
1113 prints out the tid currently used.
1114 Used for internal Samba testing purposes.
1119 <term>utimes <filename> <create time> <access time> <write time> <
1120 change time></term>
1121 <listitem><para>Changes the timestamps on a file by name.
1122 Times should be specified in the format [YY]YY:MM:DD-HH:MM:SS or -1 for no change.
1130 <title>NOTES</title>
1132 <para>Some servers are fussy about the case of supplied usernames,
1133 passwords, share names (AKA service names) and machine names.
1134 If you fail to connect try giving all parameters in uppercase.
1137 <para>It is often necessary to use the -n option when connecting
1138 to some types of servers. For example OS/2 LanManager insists
1139 on a valid NetBIOS name being used, so you need to supply a valid
1140 name that would be known to the server.</para>
1142 <para>smbclient supports long file names where the server
1143 supports the LANMAN2 protocol or above. </para>
1147 <title>ENVIRONMENT VARIABLES</title>
1149 <para>See the <command>--user</command> and
1150 <command>--password</command> options for details on ways to
1151 specify a username and password via an environment variable.
1157 <title>INSTALLATION</title>
1159 <para>The location of the client program is a matter for
1160 individual system administrators. The following are thus
1161 suggestions only. </para>
1163 <para>It is recommended that the smbclient software be installed
1164 in the <filename>/usr/local/samba/bin/</filename> or <filename>
1165 /usr/samba/bin/</filename> directory, this directory readable
1166 by all, writeable only by root. The client program itself should
1167 be executable by all. The client should <emphasis>NOT</emphasis> be
1168 setuid or setgid! </para>
1170 <para>The client log files should be put in a directory readable
1171 and writeable only by the user. </para>
1173 <para>To test the client, you will need to know the name of a
1174 running SMB/CIFS server. It is possible to run <citerefentry><refentrytitle>smbd</refentrytitle>
1175 <manvolnum>8</manvolnum></citerefentry> as an ordinary user - running that server as a daemon
1176 on a user-accessible port (typically any port number over 1024)
1177 would provide a suitable test server. </para>
1182 <title>DIAGNOSTICS</title>
1184 <para>Most diagnostics issued by the client are logged in a
1185 specified log file. The log file name is specified at compile time,
1186 but may be overridden on the command line. </para>
1188 <para>The number and nature of diagnostics available depends
1189 on the debug level used by the client. If you have problems,
1190 set the debug level to 3 and peruse the log files. </para>
1195 <title>VERSION</title>
1197 <para>This man page is part of version &doc.version; of the Samba suite.</para>
1202 <title>AUTHOR</title>
1204 <para>The original Samba software and related utilities
1205 were created by Andrew Tridgell. Samba is now developed
1206 by the Samba Team as an Open Source project similar
1207 to the way the Linux kernel is developed.</para>