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">4.0</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">-b <buffer size></arg>
24 <arg choice="opt">-d debuglevel</arg>
25 <arg choice="opt">-e</arg>
26 <arg choice="opt">-L <netbios name></arg>
27 <arg choice="opt">-U username</arg>
28 <arg choice="opt">-I destinationIP</arg>
29 <arg choice="opt">-M <netbios name></arg>
30 <arg choice="opt">-m maxprotocol</arg>
31 <arg choice="opt">-A authfile</arg>
32 <arg choice="opt">-N</arg>
33 <arg choice="opt">-C</arg>
34 <arg choice="opt">-g</arg>
35 <arg choice="opt">-i scope</arg>
36 <arg choice="opt">-O <socket options></arg>
37 <arg choice="opt">-p port</arg>
38 <arg choice="opt">-R <name resolve order></arg>
39 <arg choice="opt">-s <smb config file></arg>
40 <arg choice="opt">-k</arg>
41 <arg choice="opt">-P</arg>
42 <arg choice="opt">-c <command></arg>
46 <command>smbclient</command>
47 <arg choice="req">servicename</arg>
48 <arg choice="opt">password</arg>
49 <arg choice="opt">-b <buffer size></arg>
50 <arg choice="opt">-d debuglevel</arg>
51 <arg choice="opt">-e</arg>
52 <arg choice="opt">-D Directory</arg>
53 <arg choice="opt">-U username</arg>
54 <arg choice="opt">-W workgroup</arg>
55 <arg choice="opt">-M <netbios name></arg>
56 <arg choice="opt">-m maxprotocol</arg>
57 <arg choice="opt">-A authfile</arg>
58 <arg choice="opt">-N</arg>
59 <arg choice="opt">-C</arg>
60 <arg choice="opt">-g</arg>
61 <arg choice="opt">-l log-basename</arg>
62 <arg choice="opt">-I destinationIP</arg>
63 <arg choice="opt">-E</arg>
64 <arg choice="opt">-c <command string></arg>
65 <arg choice="opt">-i scope</arg>
66 <arg choice="opt">-O <socket options></arg>
67 <arg choice="opt">-p port</arg>
68 <arg choice="opt">-R <name resolve order></arg>
69 <arg choice="opt">-s <smb config file></arg>
70 <arg choice="opt">-T<c|x>IXFqgbNan</arg>
71 <arg choice="opt">-k</arg>
76 <title>DESCRIPTION</title>
78 <para>This tool is part of the <citerefentry><refentrytitle>samba</refentrytitle>
79 <manvolnum>7</manvolnum></citerefentry> suite.</para>
81 <para><command>smbclient</command> is a client that can
82 'talk' to an SMB/CIFS server. It offers an interface
83 similar to that of the ftp program (see <citerefentry><refentrytitle>ftp</refentrytitle>
84 <manvolnum>1</manvolnum></citerefentry>).
85 Operations include things like getting files from the server
86 to the local machine, putting files from the local machine to
87 the server, retrieving directory information from the server
93 <title>OPTIONS</title>
97 <term>servicename</term>
98 <listitem><para>servicename is the name of the service
99 you want to use on the server. A service name takes the form
100 <filename>//server/service</filename> where <parameter>server
101 </parameter> is the NetBIOS name of the SMB/CIFS server
102 offering the desired service and <parameter>service</parameter>
103 is the name of the service offered. Thus to connect to
104 the service "printer" on the SMB/CIFS server "smbserver",
105 you would use the servicename <filename>//smbserver/printer
108 <para>Note that the server name required is NOT necessarily
109 the IP (DNS) host name of the server ! The name required is
110 a NetBIOS server name, which may or may not be the
111 same as the IP hostname of the machine running the server.
114 <para>The server name is looked up according to either
115 the <parameter>-R</parameter> parameter to <command>smbclient</command> or
116 using the name resolve order parameter in
117 the <citerefentry><refentrytitle>smb.conf</refentrytitle>
118 <manvolnum>5</manvolnum></citerefentry> file,
119 allowing an administrator to change the order and methods
120 by which server names are looked up. </para></listitem>
124 <term>password</term>
125 <listitem><para>The password required to access the specified
126 service on the specified server. If this parameter is
127 supplied, the <parameter>-N</parameter> option (suppress
128 password prompt) is assumed. </para>
130 <para>There is no default password. If no password is supplied
131 on the command line (either by using this parameter or adding
132 a password to the <parameter>-U</parameter> option (see
133 below)) and the <parameter>-N</parameter> option is not
134 specified, the client will prompt for a password, even if
135 the desired service does not require one. (If no password is
136 required, simply press ENTER to provide a null password.)
139 <para>Note: Some servers (including OS/2 and Windows for
140 Workgroups) insist on an uppercase password. Lowercase
141 or mixed case passwords may be rejected by these servers.
144 <para>Be cautious about including passwords in scripts.
149 <term>-R|--name-resolve <name resolve order></term>
150 <listitem><para>This option is used by the programs in the Samba
151 suite to determine what naming services and in what order to resolve
152 host names to IP addresses. The option takes a space-separated
153 string of different name resolution options.</para>
155 <para>The options are :"lmhosts", "host", "wins" and "bcast". They
156 cause names to be resolved as follows:</para>
159 <listitem><para><constant>lmhosts</constant>: Lookup an IP
160 address in the Samba lmhosts file. If the line in lmhosts has
161 no name type attached to the NetBIOS name (see
162 the <citerefentry><refentrytitle>lmhosts</refentrytitle>
163 <manvolnum>5</manvolnum></citerefentry> for details) then
164 any name type matches for lookup.</para>
167 <listitem><para><constant>host</constant>: Do a standard host
168 name to IP address resolution, using the system <filename>/etc/hosts
169 </filename>, NIS, or DNS lookups. This method of name resolution
170 is operating system dependent, for instance on IRIX or Solaris this
171 may be controlled by the <filename>/etc/nsswitch.conf</filename>
172 file). Note that this method is only used if the NetBIOS name
173 type being queried is the 0x20 (server) name type, otherwise
174 it is ignored.</para>
177 <listitem><para><constant>wins</constant>: Query a name with
178 the IP address listed in the <parameter>wins server</parameter>
179 parameter. If no WINS server has
180 been specified this method will be ignored.</para>
183 <listitem><para><constant>bcast</constant>: Do a broadcast on
184 each of the known local interfaces listed in the
185 <parameter>interfaces</parameter>
186 parameter. This is the least reliable of the name resolution
187 methods as it depends on the target host being on a locally
188 connected subnet.</para>
192 <para>If this parameter is not set then the name resolve order
193 defined in the <citerefentry><refentrytitle>smb.conf</refentrytitle>
194 <manvolnum>5</manvolnum></citerefentry> file parameter
195 (name resolve order) will be used. </para>
197 <para>The default order is lmhosts, host, wins, bcast and without
198 this parameter or any entry in the <parameter>name resolve order
199 </parameter> parameter of the <citerefentry><refentrytitle>smb.conf</refentrytitle>
200 <manvolnum>5</manvolnum></citerefentry> file the name resolution
201 methods will be attempted in this order. </para></listitem>
206 <term>-M|--message NetBIOS name</term>
207 <listitem><para>This options allows you to send messages, using
208 the "WinPopup" protocol, to another computer. Once a connection is
209 established you then type your message, pressing ^D (control-D) to
212 <para>If the receiving computer is running WinPopup the user will
213 receive the message and probably a beep. If they are not running
214 WinPopup the message will be lost, and no error message will
217 <para>The message is also automatically truncated if the message
218 is over 1600 bytes, as this is the limit of the protocol.
222 One useful trick is to pipe the message through <command>smbclient</command>.
223 For example: smbclient -M FRED < mymessage.txt will send the
224 message in the file <filename>mymessage.txt</filename> to the
228 <para>You may also find the <parameter>-U</parameter> and
229 <parameter>-I</parameter> options useful, as they allow you to
230 control the FROM and TO parts of the message. </para>
232 <para>See the <parameter>message command</parameter> parameter in the <citerefentry><refentrytitle>smb.conf</refentrytitle>
233 <manvolnum>5</manvolnum></citerefentry> for a description of how to handle incoming
234 WinPopup messages in Samba. </para>
236 <para><emphasis>Note</emphasis>: Copy WinPopup into the startup group
237 on your WfWg PCs if you want them to always be able to receive
238 messages. </para></listitem>
242 <term>-p|--port port</term>
243 <listitem><para>This number is the TCP port number that will be used
244 when making connections to the server. The standard (well-known)
245 TCP port number for an SMB/CIFS server is 139, which is the
246 default. </para></listitem>
250 <term>-g|--grepable</term>
251 <listitem><para>This parameter provides combined with
252 <parameter>-L</parameter> easy parseable output that allows processing
253 with utilities such as grep and cut.
258 <term>-m|--max-protocol protocol</term>
259 <listitem><para>This allows the user to select the
260 highest SMB protocol level that smbclient will use to
261 connect to the server. By default this is set to
262 NT1, which is the highest available SMB1 protocol.
263 To connect using SMB2 or SMB3 protocol, use the
264 strings SMB2 or SMB3 respectively. Note that to connect
265 to a Windows 2012 server with encrypted transport selecting
266 a max-protocol of SMB3 is required.
271 <term>-P|--machine-pass</term>
273 Make queries to the external server using the machine account of the local server.
280 <term>-I|--ip-address IP-address</term>
281 <listitem><para><replaceable>IP address</replaceable> is the address of the server to connect to.
282 It should be specified in standard "a.b.c.d" notation. </para>
284 <para>Normally the client would attempt to locate a named
285 SMB/CIFS server by looking it up via the NetBIOS name resolution
286 mechanism described above in the <parameter>name resolve order</parameter>
287 parameter above. Using this parameter will force the client
288 to assume that the server is on the machine with the specified IP
289 address and the NetBIOS name component of the resource being
290 connected to will be ignored. </para>
292 <para>There is no default for this parameter. If not supplied,
293 it will be determined automatically by the client as described
294 above. </para></listitem>
298 <term>-E|--stderr</term>
299 <listitem><para>This parameter causes the client to write messages
300 to the standard error stream (stderr) rather than to the standard
301 output stream. </para>
303 <para>By default, the client writes messages to standard output
304 - typically the user's tty. </para></listitem>
308 <term>-L|--list</term>
309 <listitem><para>This option allows you to look at what services
310 are available on a server. You use it as <command>smbclient -L
311 host</command> and a list should appear. The <parameter>-I
312 </parameter> option may be useful if your NetBIOS names don't
313 match your TCP/IP DNS host names or if you are trying to reach a
314 host on another network. </para></listitem>
318 <term>-b|--send-buffer buffersize</term>
320 When sending or receiving files, smbclient uses an
321 internal buffer sized by the maximum number of allowed requests
322 to the connected server. This command allows this size to be set to any
323 range between 0 (which means use the default server controlled size) bytes
324 and 16776960 (0xFFFF00) bytes. Using the server controlled size is the
325 most efficient as smbclient will pipeline as many simultaneous reads or
326 writes needed to keep the server as busy as possible. Setting this to
327 any other size will slow down the transfer. This can also be set
328 using the <command>iosize</command> command inside smbclient.
333 <term>-e|--encrypt</term>
335 This command line parameter requires the remote
336 server support the UNIX extensions or that the SMB3 protocol has been selected.
337 Requests that the connection be encrypted. Negotiates SMB encryption using either
338 SMB3 or POSIX extensions via GSSAPI. Uses the given credentials for
339 the encryption negotiation (either kerberos or NTLMv1/v2 if given
340 domain/username/password triple. Fails the connection if encryption
341 cannot be negotiated.
345 &stdarg.client.debug;
347 &popt.common.credentials;
348 &popt.common.connection;
351 <term>-T|--tar tar options</term>
352 <listitem><para>smbclient may be used to create <command>tar(1)
353 </command> compatible backups of all the files on an SMB/CIFS
354 share. The secondary tar flags that can be given to this option
358 <listitem><para><parameter>c</parameter> - Create a tar file on UNIX.
359 Must be followed by the name of a tar file, tape device
360 or "-" for standard output. If using standard output you must
361 turn the log level to its lowest value -d0 to avoid corrupting
362 your tar file. This flag is mutually exclusive with the
363 <parameter>x</parameter> flag. </para></listitem>
365 <listitem><para><parameter>x</parameter> - Extract (restore) a local
366 tar file back to a share. Unless the -D option is given, the tar
367 files will be restored from the top level of the share. Must be
368 followed by the name of the tar file, device or "-" for standard
369 input. Mutually exclusive with the <parameter>c</parameter> flag.
370 Restored files have their creation times (mtime) set to the
371 date saved in the tar file. Directories currently do not get
372 their creation dates restored properly. </para></listitem>
374 <listitem><para><parameter>I</parameter> - Include files and directories.
375 Is the default behavior when filenames are specified above. Causes
376 files to be included in an extract or create (and therefore
377 everything else to be excluded). See example below. Filename globbing
378 works in one of two ways. See <parameter>r</parameter> below. </para></listitem>
380 <listitem><para><parameter>X</parameter> - Exclude files and directories.
381 Causes files to be excluded from an extract or create. See
382 example below. Filename globbing works in one of two ways now.
383 See <parameter>r</parameter> below. </para></listitem>
385 <listitem><para><parameter>F</parameter> - File containing a list of files and directories.
386 The <parameter>F</parameter> causes the name following the tarfile to
387 create to be read as a filename that contains a list of files and directories to
388 be included in an extract or create (and therefore everything else to be excluded).
389 See example below. Filename globbing works in one of two ways.
390 See <parameter>r</parameter> below.
393 <listitem><para><parameter>b</parameter> - Blocksize. Must be followed
394 by a valid (greater than zero) blocksize. Causes tar file to be
395 written out in blocksize*TBLOCK (usually 512 byte) blocks.
398 <listitem><para><parameter>g</parameter> - Incremental. Only back up
399 files that have the archive bit set. Useful only with the
400 <parameter>c</parameter> flag. </para></listitem>
402 <listitem><para><parameter>q</parameter> - Quiet. Keeps tar from printing
403 diagnostics as it works. This is the same as tarmode quiet.
406 <listitem><para><parameter>r</parameter> - Regular expression include
407 or exclude. Uses regular expression matching for
408 excluding or excluding files if compiled with HAVE_REGEX_H.
409 However this mode can be very slow. If not compiled with
410 HAVE_REGEX_H, does a limited wildcard match on '*' and '?'.
413 <listitem><para><parameter>N</parameter> - Newer than. Must be followed
414 by the name of a file whose date is compared against files found
415 on the share during a create. Only files newer than the file
416 specified are backed up to the tar file. Useful only with the
417 <parameter>c</parameter> flag. </para></listitem>
419 <listitem><para><parameter>a</parameter> - Set archive bit. Causes the
420 archive bit to be reset when a file is backed up. Useful with the
421 <parameter>g</parameter> and <parameter>c</parameter> flags.
425 <para><emphasis>Tar Long File Names</emphasis></para>
427 <para><command>smbclient</command>'s tar option now supports long
428 file names both on backup and restore. However, the full path
429 name of the file must be less than 1024 bytes. Also, when
430 a tar archive is created, <command>smbclient</command>'s tar option places all
431 files in the archive with relative names, not absolute names.
434 <para><emphasis>Tar Filenames</emphasis></para>
436 <para>All file names can be given as DOS path names (with '\\'
437 as the component separator) or as UNIX path names (with '/' as
438 the component separator). </para>
440 <para><emphasis>Examples</emphasis></para>
442 <para>Restore from tar file <filename>backup.tar</filename> into myshare on mypc
443 (no password on share). </para>
445 <para><command>smbclient //mypc/myshare "" -N -Tx backup.tar
448 <para>Restore everything except <filename>users/docs</filename>
451 <para><command>smbclient //mypc/myshare "" -N -TXx backup.tar
452 users/docs</command></para>
454 <para>Create a tar file of the files beneath <filename>
455 users/docs</filename>. </para>
457 <para><command>smbclient //mypc/myshare "" -N -Tc
458 backup.tar users/docs </command></para>
460 <para>Create the same tar file as above, but now use
461 a DOS path name. </para>
463 <para><command>smbclient //mypc/myshare "" -N -Tc backup.tar
464 users\edocs </command></para>
466 <para>Create a tar file of the files listed in the file <filename>tarlist</filename>.</para>
468 <para><command>smbclient //mypc/myshare "" -N -TcF
469 backup.tar tarlist</command></para>
471 <para>Create a tar file of all the files and directories in
474 <para><command>smbclient //mypc/myshare "" -N -Tc backup.tar *
480 <term>-D|--directory initial directory</term>
481 <listitem><para>Change to initial directory before starting. Probably
482 only of any use with the tar -T option. </para></listitem>
486 <term>-c|--command command string</term>
487 <listitem><para>command string is a semicolon-separated list of
488 commands to be executed instead of prompting from stdin. <parameter>
489 -N</parameter> is implied by <parameter>-c</parameter>.</para>
491 <para>This is particularly useful in scripts and for printing stdin
492 to the server, e.g. <command>-c 'print -'</command>. </para></listitem>
500 <title>OPERATIONS</title>
502 <para>Once the client is running, the user is presented with
505 <para><prompt>smb:\> </prompt></para>
507 <para>The backslash ("\\") indicates the current working directory
508 on the server, and will change if the current working directory
511 <para>The prompt indicates that the client is ready and waiting to
512 carry out a user command. Each command is a single word, optionally
513 followed by parameters specific to that command. Command and parameters
514 are space-delimited unless these notes specifically
515 state otherwise. All commands are case-insensitive. Parameters to
516 commands may or may not be case sensitive, depending on the command.
519 <para>You can specify file names which have spaces in them by quoting
520 the name with double quotes, for example "a long file name". </para>
522 <para>Parameters shown in square brackets (e.g., "[parameter]") are
523 optional. If not given, the command will use suitable defaults. Parameters
524 shown in angle brackets (e.g., "<parameter>") are required.
528 <para>Note that all commands operating on the server are actually
529 performed by issuing a request to the server. Thus the behavior may
530 vary from server to server, depending on how the server was implemented.
533 <para>The commands available are given here in alphabetical order. </para>
537 <term>? [command]</term>
538 <listitem><para>If <replaceable>command</replaceable> is specified, the ? command will display
539 a brief informative message about the specified command. If no
540 command is specified, a list of available commands will
541 be displayed. </para></listitem>
545 <term>! [shell command]</term>
546 <listitem><para>If <replaceable>shell command</replaceable> is specified, the !
547 command will execute a shell locally and run the specified shell
548 command. If no command is specified, a local shell will be run.
553 <term>allinfo file</term>
554 <listitem><para>The client will request that the server return
555 all known information about a file or directory (including streams).
560 <term>altname file</term>
561 <listitem><para>The client will request that the server return
562 the "alternate" name (the 8.3 name) for a file or directory.
567 <term>archive <number></term>
568 <listitem><para>Sets the archive level when operating on files.
569 0 means ignore the archive bit, 1 means only operate on files with this bit set,
570 2 means only operate on files with this bit set and reset it after operation,
571 3 means operate on all files and reset it after operation. The default is 0.
577 <listitem><para>Toggle the state of the "backup intent" flag
578 sent to the server on directory listings and file opens. If
579 the "backup intent" flag is true, the server will try and
580 bypass some file system checks if the user has been granted
581 SE_BACKUP or SE_RESTORE privilages. This state is useful when
582 performing a backup or restore operation.
587 <term>blocksize <number></term>
588 <listitem><para>Sets the blocksize parameter for a tar operation. The default is 20.
589 Causes tar file to be written out in blocksize*TBLOCK (normally 512 byte) units.
594 <term>cancel jobid0 [jobid1] ... [jobidN]</term>
595 <listitem><para>The client will request that the server cancel
596 the printjobs identified by the given numeric print job ids.
601 <term>case_sensitive</term>
602 <listitem><para>Toggles the setting of the flag in SMB packets that
603 tells the server to treat filenames as case sensitive. Set to OFF by
604 default (tells file server to treat filenames as case insensitive). Only
605 currently affects Samba 3.0.5 and above file servers with the case sensitive
606 parameter set to auto in the smb.conf.
611 <term>cd <directory name></term>
612 <listitem><para>If "directory name" is specified, the current
613 working directory on the server will be changed to the directory
614 specified. This operation will fail if for any reason the specified
615 directory is inaccessible. </para>
617 <para>If no directory name is specified, the current working
618 directory on the server will be reported. </para></listitem>
622 <term>chmod file mode in octal</term>
623 <listitem><para>This command depends on the server supporting the CIFS
624 UNIX extensions and will fail if the server does not. The client requests that the server
625 change the UNIX permissions to the given octal mode, in standard UNIX format.
630 <term>chown file uid gid</term>
631 <listitem><para>This command depends on the server supporting the CIFS
632 UNIX extensions and will fail if the server does not. The client requests that the server
633 change the UNIX user and group ownership to the given decimal values. Note there is
634 currently no way to remotely look up the UNIX uid and gid values for a given name.
635 This may be addressed in future versions of the CIFS UNIX extensions.
640 <term>close <fileid></term>
641 <listitem><para>Closes a file explicitly opened by the open command. Used for
642 internal Samba testing purposes.
647 <term>del <mask></term>
648 <listitem><para>The client will request that the server attempt
649 to delete all files matching <replaceable>mask</replaceable> from the current working
650 directory on the server. </para></listitem>
654 <term>dir <mask></term>
655 <listitem><para>A list of the files matching <replaceable>mask</replaceable> in the current
656 working directory on the server will be retrieved from the server
657 and displayed. </para></listitem>
661 <term>du <filename></term>
662 <listitem><para>Does a directory listing and then prints out the current disk usage and free space on a share.
667 <term>echo <number> <data></term>
668 <listitem><para>Does an SMBecho request to ping the server. Used for internal Samba testing purposes.
674 <listitem><para>Terminate the connection with the server and exit
675 from the program. </para></listitem>
679 <term>get <remote file name> [local file name]</term>
680 <listitem><para>Copy the file called <filename>remote file name</filename> from
681 the server to the machine running the client. If specified, name
682 the local copy <filename>local file name</filename>. Note that all transfers in
683 <command>smbclient</command> are binary. See also the
684 lowercase command. </para></listitem>
688 <term>getfacl <filename></term>
689 <listitem><para>Requires the server support the UNIX extensions. Requests and prints
690 the POSIX ACL on a file.
695 <term>hardlink <src> <dest></term>
696 <listitem><para>Creates a hardlink on the server using Windows CIFS semantics.
701 <term>help [command]</term>
702 <listitem><para>See the ? command above. </para></listitem>
706 <term>history</term> <listitem><para>Displays the command history.</para></listitem>
710 <term>iosize <bytes></term>
712 When sending or receiving files, smbclient uses an
713 internal buffer sized by the maximum number of allowed requests
714 to the connected server. This command allows this size to be set to any
715 range between 0 (which means use the default server controlled size) bytes
716 and 16776960 (0xFFFF00) bytes. Using the server controlled size is the
717 most efficient as smbclient will pipeline as many simultaneous reads or
718 writes needed to keep the server as busy as possible. Setting this to
719 any other size will slow down the transfer.
724 <term>lcd [directory name]</term>
725 <listitem><para>If <replaceable>directory name</replaceable> is specified, the current
726 working directory on the local machine will be changed to
727 the directory specified. This operation will fail if for any
728 reason the specified directory is inaccessible. </para>
730 <para>If no directory name is specified, the name of the
731 current working directory on the local machine will be reported.
736 <term>link target linkname</term>
737 <listitem><para>This command depends on the server supporting the CIFS
738 UNIX extensions and will fail if the server does not. The client requests that the server
739 create a hard link between the linkname and target files. The linkname file
745 <term>listconnect</term>
746 <listitem><para>Show the current connections held for DFS purposes.
751 <term>lock <filenum> <r|w> <hex-start> <hex-len></term>
752 <listitem><para>This command depends on the server supporting the CIFS
753 UNIX extensions and will fail if the server does not. Tries to set a POSIX
754 fcntl lock of the given type on the given range. Used for internal Samba testing purposes.
759 <term>logon <username> <password></term>
760 <listitem><para>Establishes a new vuid for this session by logging on again.
761 Replaces the current vuid. Prints out the new vuid. Used for internal Samba testing purposes.
767 <listitem><para>Logs the user off the server, closing the session.
768 Used for internal Samba testing purposes.
773 <term>lowercase</term>
774 <listitem><para>Toggle lowercasing of filenames for the get and
778 <para>When lowercasing is toggled ON, local filenames are converted
779 to lowercase when using the get and mget commands. This is
780 often useful when copying (say) MSDOS files from a server, because
781 lowercase filenames are the norm on UNIX systems. </para></listitem>
785 <term>ls <mask></term>
786 <listitem><para>See the dir command above. </para></listitem>
790 <term>mask <mask></term>
791 <listitem><para>This command allows the user to set up a mask
792 which will be used during recursive operation of the mget and
793 mput commands. </para>
795 <para>The masks specified to the mget and mput commands act as
796 filters for directories rather than files when recursion is
799 <para>The mask specified with the mask command is necessary
800 to filter files within those directories. For example, if the
801 mask specified in an mget command is "source*" and the mask
802 specified with the mask command is "*.c" and recursion is
803 toggled ON, the mget command will retrieve all files matching
804 "*.c" in all directories below and including all directories
805 matching "source*" in the current working directory. </para>
807 <para>Note that the value for mask defaults to blank (equivalent
808 to "*") and remains so until the mask command is used to change it.
809 It retains the most recently specified value indefinitely. To
810 avoid unexpected results it would be wise to change the value of
811 mask back to "*" after using the mget or mput commands. </para></listitem>
815 <term>md <directory name></term>
816 <listitem><para>See the mkdir command. </para></listitem>
820 <term>mget <mask></term>
821 <listitem><para>Copy all files matching <replaceable>mask</replaceable> from the server to
822 the machine running the client. </para>
824 <para>Note that <replaceable>mask</replaceable> is interpreted differently during recursive
825 operation and non-recursive operation - refer to the recurse and
826 mask commands for more information. Note that all transfers in
827 <command>smbclient</command> are binary. See also the lowercase command. </para></listitem>
831 <term>mkdir <directory name></term>
832 <listitem><para>Create a new directory on the server (user access
833 privileges permitting) with the specified name. </para></listitem>
837 <term>more <file name></term>
838 <listitem><para>Fetch a remote file and view it with the contents
839 of your PAGER environment variable.
844 <term>mput <mask></term>
845 <listitem><para>Copy all files matching <replaceable>mask</replaceable> in the current working
846 directory on the local machine to the current working directory on
849 <para>Note that <replaceable>mask</replaceable> is interpreted differently during recursive
850 operation and non-recursive operation - refer to the recurse and mask
851 commands for more information. Note that all transfers in <command>smbclient</command>
852 are binary. </para></listitem>
857 <listitem><para>Query the remote server to see if it supports the CIFS UNIX
858 extensions and prints out the list of capabilities supported. If so, turn
859 on POSIX pathname processing and large file read/writes (if available),.
864 <term>posix_encrypt <domain> <username> <password></term>
865 <listitem><para>This command depends on the server supporting the CIFS
866 UNIX extensions and will fail if the server does not. Attempt to negotiate
867 SMB encryption on this connection. If smbclient connected with kerberos
868 credentials (-k) the arguments to this command are ignored and the kerberos
869 credentials are used to negotiate GSSAPI signing and sealing instead. See
870 also the -e option to smbclient to force encryption on initial connection.
871 This command is new with Samba 3.2.
876 <term>posix_open <filename> <octal mode></term>
877 <listitem><para>This command depends on the server supporting the CIFS
878 UNIX extensions and will fail if the server does not. Opens a remote file
879 using the CIFS UNIX extensions and prints a fileid. Used for internal Samba
885 <term>posix_mkdir <directoryname> <octal mode></term>
886 <listitem><para>This command depends on the server supporting the CIFS
887 UNIX extensions and will fail if the server does not. Creates a remote directory
888 using the CIFS UNIX extensions with the given mode.
893 <term>posix_rmdir <directoryname></term>
894 <listitem><para>This command depends on the server supporting the CIFS
895 UNIX extensions and will fail if the server does not. Deletes a remote directory
896 using the CIFS UNIX extensions.
901 <term>posix_unlink <filename></term>
902 <listitem><para>This command depends on the server supporting the CIFS
903 UNIX extensions and will fail if the server does not. Deletes a remote file
904 using the CIFS UNIX extensions.
909 <term>print <file name></term>
910 <listitem><para>Print the specified file from the local machine
911 through a printable service on the server. </para></listitem>
916 <listitem><para>Toggle prompting for filenames during operation
917 of the mget and mput commands. </para>
919 <para>When toggled ON, the user will be prompted to confirm
920 the transfer of each file during these commands. When toggled
921 OFF, all specified files will be transferred without prompting.
926 <term>put <local file name> [remote file name]</term>
927 <listitem><para>Copy the file called <filename>local file name</filename> from the
928 machine running the client to the server. If specified,
929 name the remote copy <filename>remote file name</filename>. Note that all transfers
930 in <command>smbclient</command> are binary. See also the lowercase command.
936 <listitem><para>Displays the print queue, showing the job id,
937 name, size and current status. </para></listitem>
942 <listitem><para>See the exit command. </para></listitem>
946 <term>readlink symlinkname</term>
947 <listitem><para>This command depends on the server supporting the CIFS
948 UNIX extensions and will fail if the server does not. Print
949 the value of the symlink "symlinkname".
954 <term>rd <directory name></term>
955 <listitem><para>See the rmdir command. </para></listitem>
960 <listitem><para>Toggle directory recursion for the commands mget
963 <para>When toggled ON, these commands will process all directories
964 in the source directory (i.e., the directory they are copying
965 from ) and will recurse into any that match the mask specified
966 to the command. Only files that match the mask specified using
967 the mask command will be retrieved. See also the mask command.
970 <para>When recursion is toggled OFF, only files from the current
971 working directory on the source machine that match the mask specified
972 to the mget or mput commands will be copied, and any mask specified
973 using the mask command will be ignored. </para></listitem>
977 <term>rename <old filename> <new filename></term>
978 <listitem><para>Rename files in the current working directory on the
979 server from <replaceable>old filename</replaceable> to
980 <replaceable>new filename</replaceable>. </para></listitem>
984 <term>rm <mask></term>
985 <listitem><para>Remove all files matching <replaceable>mask</replaceable> from the current
986 working directory on the server. </para></listitem>
990 <term>rmdir <directory name></term>
991 <listitem><para>Remove the specified directory (user access
992 privileges permitting) from the server. </para></listitem>
996 <term>setmode <filename> <perm=[+|\-]rsha></term>
997 <listitem><para>A version of the DOS attrib command to set
998 file permissions. For example: </para>
1000 <para><command>setmode myfile +r </command></para>
1002 <para>would make myfile read only. </para></listitem>
1006 <term>showconnect</term>
1007 <listitem><para>Show the currently active connection held for DFS purposes.
1012 <term>stat file</term>
1013 <listitem><para>This command depends on the server supporting the CIFS
1014 UNIX extensions and will fail if the server does not. The client requests the
1015 UNIX basic info level and prints out the same info that the Linux stat command
1016 would about the file. This includes the size, blocks used on disk, file type,
1017 permissions, inode number, number of links and finally the three timestamps
1018 (access, modify and change). If the file is a special file (symlink, character or
1019 block device, fifo or socket) then extra information may also be printed.
1024 <term>symlink target linkname</term>
1025 <listitem><para>This command depends on the server supporting the CIFS
1026 UNIX extensions and will fail if the server does not. The client requests that the server
1027 create a symbolic hard link between the target and linkname files. The linkname file
1028 must not exist. Note that the server will not create a link to any path that lies
1029 outside the currently connected share. This is enforced by the Samba server.
1034 <term>tar <c|x>[IXbgNa]</term>
1035 <listitem><para>Performs a tar operation - see the <parameter>-T
1036 </parameter> command line option above. Behavior may be affected
1037 by the tarmode command (see below). Using g (incremental) and N
1038 (newer) will affect tarmode settings. Note that using the "-" option
1039 with tar x may not work - use the command line option instead.
1044 <term>blocksize <blocksize></term>
1045 <listitem><para>Blocksize. Must be followed by a valid (greater
1046 than zero) blocksize. Causes tar file to be written out in
1047 <replaceable>blocksize</replaceable>*TBLOCK (usually 512 byte) blocks. </para></listitem>
1051 <term>tarmode <full|inc|reset|noreset></term>
1052 <listitem><para>Changes tar's behavior with regard to archive
1053 bits. In full mode, tar will back up everything regardless of the
1054 archive bit setting (this is the default mode). In incremental mode,
1055 tar will only back up files with the archive bit set. In reset mode,
1056 tar will reset the archive bit on all files it backs up (implies
1057 read/write share). </para></listitem>
1061 <term>unlock <filenum> <hex-start> <hex-len></term>
1062 <listitem><para>This command depends on the server supporting the CIFS
1063 UNIX extensions and will fail if the server does not. Tries to unlock a POSIX
1064 fcntl lock on the given range. Used for internal Samba testing purposes.
1070 <listitem><para>Prints the current volume name of the share.
1075 <term>vuid <number></term>
1076 <listitem><para>Changes the currently used vuid in the protocol to
1077 the given arbitrary number. Without an argument prints out the current
1078 vuid being used. Used for internal Samba testing purposes.
1083 <term>tcon <sharename></term>
1084 <listitem><para>Establishes a new tree connect (connection to a share).
1085 Replaces the current tree connect. Prints the new tid (tree id).
1086 Used for internal Samba testing purposes.
1092 <listitem><para>Close the current share connection (tree disconnect).
1093 Used for internal Samba testing purposes.
1098 <term>tid <number></term>
1099 <listitem><para>Changes the current tree id (tid) in the
1100 protocol to a new arbitrary number. Without an argument, it
1101 prints out the tid currently used.
1102 Used for internal Samba testing purposes.
1110 <title>NOTES</title>
1112 <para>Some servers are fussy about the case of supplied usernames,
1113 passwords, share names (AKA service names) and machine names.
1114 If you fail to connect try giving all parameters in uppercase.
1117 <para>It is often necessary to use the -n option when connecting
1118 to some types of servers. For example OS/2 LanManager insists
1119 on a valid NetBIOS name being used, so you need to supply a valid
1120 name that would be known to the server.</para>
1122 <para>smbclient supports long file names where the server
1123 supports the LANMAN2 protocol or above. </para>
1127 <title>ENVIRONMENT VARIABLES</title>
1129 <para>The variable <envar>USER</envar> may contain the
1130 username of the person using the client. This information is
1131 used only if the protocol level is high enough to support
1132 session-level passwords.</para>
1135 <para>The variable <envar>PASSWD</envar> may contain
1136 the password of the person using the client. This information is
1137 used only if the protocol level is high enough to support
1138 session-level passwords. </para>
1140 <para>The variable <envar>LIBSMB_PROG</envar> may contain
1141 the path, executed with system(), which the client should connect
1142 to instead of connecting to a server. This functionality is primarily
1143 intended as a development aid, and works best when using a LMHOSTS
1149 <title>INSTALLATION</title>
1151 <para>The location of the client program is a matter for
1152 individual system administrators. The following are thus
1153 suggestions only. </para>
1155 <para>It is recommended that the smbclient software be installed
1156 in the <filename>/usr/local/samba/bin/</filename> or <filename>
1157 /usr/samba/bin/</filename> directory, this directory readable
1158 by all, writeable only by root. The client program itself should
1159 be executable by all. The client should <emphasis>NOT</emphasis> be
1160 setuid or setgid! </para>
1162 <para>The client log files should be put in a directory readable
1163 and writeable only by the user. </para>
1165 <para>To test the client, you will need to know the name of a
1166 running SMB/CIFS server. It is possible to run <citerefentry><refentrytitle>smbd</refentrytitle>
1167 <manvolnum>8</manvolnum></citerefentry> as an ordinary user - running that server as a daemon
1168 on a user-accessible port (typically any port number over 1024)
1169 would provide a suitable test server. </para>
1174 <title>DIAGNOSTICS</title>
1176 <para>Most diagnostics issued by the client are logged in a
1177 specified log file. The log file name is specified at compile time,
1178 but may be overridden on the command line. </para>
1180 <para>The number and nature of diagnostics available depends
1181 on the debug level used by the client. If you have problems,
1182 set the debug level to 3 and peruse the log files. </para>
1187 <title>VERSION</title>
1189 <para>This man page is correct for version 3.2 of the Samba suite.</para>
1194 <title>AUTHOR</title>
1196 <para>The original Samba software and related utilities
1197 were created by Andrew Tridgell. Samba is now developed
1198 by the Samba Team as an Open Source project similar
1199 to the way the Linux kernel is developed.</para>
1201 <para>The original Samba man pages were written by Karl Auer.
1202 The man page sources were converted to YODL format (another
1203 excellent piece of Open Source software, available at <ulink url="ftp://ftp.icce.rug.nl/pub/unix/">
1204 ftp://ftp.icce.rug.nl/pub/unix/</ulink>) and updated for the Samba 2.0
1205 release by Jeremy Allison. The conversion to DocBook for
1206 Samba 2.2 was done by Gerald Carter. The conversion to DocBook XML 4.2 for Samba 3.0
1207 was done by Alexander Bokovoy.</para>