7 CONTENT="Modular DocBook HTML Stylesheet Version 1.57"></HEAD
27 >smbclient -- ftp-like client to access SMB/CIFS resources
30 CLASS="REFSYNOPSISDIV"
40 > {servicename} [password] [-b <buffer size>] [-d debuglevel] [-D Directory] [-S server] [-U username] [-W workgroup] [-M <netbios name>] [-m maxprotocol] [-A authfile] [-N] [-l logfile] [-L <netbios name>] [-I destinationIP] [-E <terminal code>] [-c <command string>] [-i scope] [-O <socket options>] [-p port] [-R <name resolve order>] [-s <smb config file>] [-T<c|x>IXFqgbNan]</P
50 >This tool is part of the <A
59 > is a client that can
60 'talk' to an SMB/CIFS server. It offers an interface
61 similar to that of the ftp program (see <B
65 Operations include things like getting files from the server
66 to the local machine, putting files from the local machine to
67 the server, retrieving directory information from the server
86 >servicename is the name of the service
87 you want to use on the server. A service name takes the form
97 > is the NetBIOS name of the SMB/CIFS server
98 offering the desired service and <TT
104 is the name of the service offered. Thus to connect to
105 the service "printer" on the SMB/CIFS server "smbserver",
106 you would use the servicename <TT
112 >Note that the server name required is NOT necessarily
113 the IP (DNS) host name of the server ! The name required is
114 a NetBIOS server name, which may or may not be the
115 same as the IP hostname of the machine running the server.
118 >The server name is looked up according to either
124 > parameter to smbclient or
125 using the name resolve order parameter in the smb.conf file,
126 allowing an administrator to change the order and methods
127 by which server names are looked up. </P
133 >The password required to access the specified
134 service on the specified server. If this parameter is
141 password prompt) is assumed. </P
143 >There is no default password. If no password is supplied
144 on the command line (either by using this parameter or adding
145 a password to the <TT
157 specified, the client will prompt for a password, even if
158 the desired service does not require one. (If no password is
159 required, simply press ENTER to provide a null password.)
162 >Note: Some servers (including OS/2 and Windows for
163 Workgroups) insist on an uppercase password. Lowercase
164 or mixed case passwords may be rejected by these servers.
167 >Be cautious about including passwords in scripts.
174 >Specifies the location of the all important
181 >-O socket options</DT
184 >TCP socket options to set on the client
185 socket. See the socket options parameter in the <TT
188 > manpage for the list of valid
192 >-R <name resolve order></DT
195 >This option is used by the programs in the Samba
196 suite to determine what naming services and in what order to resolve
197 host names to IP addresses. The option takes a space separated
198 string of different name resolution options.</P
200 >The options are :"lmhosts", "host", "wins" and "bcast". They
201 cause names to be resolved as follows :</P
211 address in the Samba lmhosts file. If the line in lmhosts has
212 no name type attached to the NetBIOS name (see the <A
213 HREF="lmhosts.5.html"
217 any name type matches for lookup.</P
224 > : Do a standard host
225 name to IP address resolution, using the system <TT
229 >, NIS, or DNS lookups. This method of name resolution
230 is operating system depended for instance on IRIX or Solaris this
231 may be controlled by the <TT
233 >/etc/nsswitch.conf</TT
235 file). Note that this method is only used if the NetBIOS name
236 type being queried is the 0x20 (server) name type, otherwise
244 > : Query a name with
245 the IP address listed in the <TT
251 parameter. If no WINS server has
252 been specified this method will be ignored.</P
259 > : Do a broadcast on
260 each of the known local interfaces listed in the
267 parameter. This is the least reliable of the name resolution
268 methods as it depends on the target host being on a locally
273 >If this parameter is not set then the name resolve order
278 (name resolve order) will be used. </P
280 >The default order is lmhosts, host, wins, bcast and without
281 this parameter or any entry in the <TT
287 > parameter of the smb.conf file the name resolution
288 methods will be attempted in this order. </P
294 >This options allows you to send messages, using
295 the "WinPopup" protocol, to another computer. Once a connection is
296 established you then type your message, pressing ^D (control-D) to
299 >If the receiving computer is running WinPopup the user will
300 receive the message and probably a beep. If they are not running
301 WinPopup the message will be lost, and no error message will
304 >The message is also automatically truncated if the message
305 is over 1600 bytes, as this is the limit of the protocol.
308 >One useful trick is to cat the message through
314 > cat mymessage.txt | smbclient -M FRED </B
316 send the message in the file <TT
320 to the machine FRED. </P
322 >You may also find the <TT
333 > options useful, as they allow you to
334 control the FROM and TO parts of the message. </P
336 >See the message command parameter in the <TT
339 > for a description of how to handle incoming
340 WinPopup messages in Samba. </P
344 >: Copy WinPopup into the startup group
345 on your WfWg PCs if you want them to always be able to receive
352 >This specifies a NetBIOS scope that smbclient will
353 use to communicate with when generating NetBIOS names. For details
354 on the use of NetBIOS scopes, see rfc1001.txt and rfc1002.txt.
355 NetBIOS scopes are <EM
357 > rarely used, only set
358 this parameter if you are the system administrator in charge of all
359 the NetBIOS systems you communicate with. </P
365 >If specified, this parameter suppresses the normal
366 password prompt from the client to the user. This is useful when
367 accessing a service that does not require a password. </P
369 >Unless a password is specified on the command line or
370 this parameter is specified, the client will request a
377 >By default, the client will use the local
378 machine's hostname (in uppercase) as its NetBIOS name. This parameter
379 allows you to override the host name and use whatever NetBIOS
386 >debuglevel is an integer from 0 to 10, or
389 >The default value if this parameter is not specified
392 >The higher this value, the more detail will be logged to
393 the log files about the activities of the
394 client. At level 0, only critical errors and serious warnings will
395 be logged. Level 1 is a reasonable level for day to day running -
396 it generates a small amount of information about operations
399 >Levels above 1 will generate considerable amounts of log
400 data, and should only be used when investigating a problem.
401 Levels above 3 are designed for use only by developers and
402 generate HUGE amounts of log data, most of which is extremely
403 cryptic. If debuglevel is set to the letter 'A', then <EM
406 > debug messages will be printed. This setting
407 is for developers only (and people who <EM
410 to know how the code works internally). </P
412 >Note that specifying this parameter here will override
413 the log level parameter in the <B
423 >This number is the TCP port number that will be used
424 when making connections to the server. The standard (well-known)
425 TCP port number for an SMB/CIFS server is 139, which is the
432 >If specified, logfilename specifies a base filename
433 into which operational data from the running client will be
436 >The default base name is specified at compile time.</P
438 >The base name is used to generate actual log file names.
439 For example, if the name specified was "log", the debug file
445 >The log file generated is never removed by the client.
452 >Print the usage message for the client. </P
458 >IP address is the address of the server to connect to.
459 It should be specified in standard "a.b.c.d" notation. </P
461 >Normally the client would attempt to locate a named
462 SMB/CIFS server by looking it up via the NetBIOS name resolution
463 mechanism described above in the <TT
466 >name resolve order</I
469 parameter above. Using this parameter will force the client
470 to assume that the server is on the machine with the specified IP
471 address and the NetBIOS name component of the resource being
472 connected to will be ignored. </P
474 >There is no default for this parameter. If not supplied,
475 it will be determined automatically by the client as described
482 >This parameter causes the client to write messages
483 to the standard error stream (stderr) rather than to the standard
486 >By default, the client writes messages to standard output
487 - typically the user's tty. </P
490 >-U username[%pass]</DT
493 >Sets the SMB username or username and password.
494 If %pass is not specified, The user will be prompted. The client
495 will first check the USER environment variable, then the
501 > variable and if either exist, the
502 string is uppercased. Anything in these variables following a '%'
503 sign will be treated as the password. If these environmental
504 variables are not found, the username <TT
510 >If the password is not included in these environment
511 variables (using the %pass syntax), rpcclient will look for
517 > environment variable from which
518 to read the password. </P
520 >A third option is to use a credentials file which
521 contains the plaintext of the username and password. This
522 option is mainly provided for scripts where the admin doesn't
523 desire to pass the credentials on the command line or via environment
524 variables. If this method is used, make certain that the permissions
525 on the file restrict access from unwanted users. See the
531 > for more details. </P
533 >Be cautious about including passwords in scripts or in
539 > environment variable. Also, on
540 many systems the command line of a running process may be seen
544 > command to be safe always allow
548 > to prompt for a password and type
556 you to specify a file from which to read the username and
557 password used in the connection. The format of the file is
567 CLASS="PROGRAMLISTING"
568 >username = <value>
569 password = <value>
576 >Make certain that the permissions on the file restrict
577 access from unwanted users. </P
583 >This option allows you to look at what services
584 are available on a server. You use it as <B
588 > and a list should appear. The <TT
594 > option may be useful if your NetBIOS names don't
595 match your tcp/ip dns host names or if you are trying to reach a
596 host on another network. </P
599 >-t terminal code</DT
602 >This option tells smbclient how to interpret
603 filenames coming from the remote server. Usually Asian language
604 multibyte UNIX implementations use different character sets than
605 SMB/CIFS servers (<EM
609 > for example). Setting this parameter will let
613 > convert between the UNIX filenames and
614 the SMB filenames correctly. This option has not been seriously tested
615 and may have some problems. </P
617 >The terminal codes include CWsjis, CWeuc, CWjis7, CWjis8,
618 CWjunet, CWhex, CWcap. This is not a complete list, check the Samba
619 source code for the complete list. </P
625 >This option changes the transmit/send buffer
626 size when getting or putting a file from/to the server. The default
627 is 65520 bytes. Setting this value smaller (to 1200 bytes) has been
628 observed to speed up file transfers to and from a Win9x server.
635 >Override the default workgroup specified in the
636 workgroup parameter of the <TT
640 for this connection. This may be needed to connect to some
647 >smbclient may be used to create <B
651 > compatible backups of all the files on an SMB/CIFS
652 share. The secondary tar flags that can be given to this option
664 > - Create a tar file on UNIX.
665 Must be followed by the name of a tar file, tape device
666 or "-" for standard output. If using standard output you must
667 turn the log level to its lowest value -d0 to avoid corrupting
668 your tar file. This flag is mutually exclusive with the
683 > - Extract (restore) a local
684 tar file back to a share. Unless the -D option is given, the tar
685 files will be restored from the top level of the share. Must be
686 followed by the name of the tar file, device or "-" for standard
687 input. Mutually exclusive with the <TT
693 Restored files have their creation times (mtime) set to the
694 date saved in the tar file. Directories currently do not get
695 their creation dates restored properly. </P
704 > - Include files and directories.
705 Is the default behavior when filenames are specified above. Causes
706 tar files to be included in an extract or create (and therefore
707 everything else to be excluded). See example below. Filename globbing
708 works in one of two ways. See r below. </P
717 > - Exclude files and directories.
718 Causes tar files to be excluded from an extract or create. See
719 example below. Filename globbing works in one of two ways now.
734 > - Blocksize. Must be followed
735 by a valid (greater than zero) blocksize. Causes tar file to be
736 written out in blocksize*TBLOCK (usually 512 byte) blocks.
746 > - Incremental. Only back up
747 files that have the archive bit set. Useful only with the
762 > - Quiet. Keeps tar from printing
763 diagnostics as it works. This is the same as tarmode quiet.
773 > - Regular expression include
774 or exclude. Uses regular regular expression matching for
775 excluding or excluding files if compiled with HAVE_REGEX_H.
776 However this mode can be very slow. If not compiled with
777 HAVE_REGEX_H, does a limited wildcard match on '*' and '?'.
787 > - Newer than. Must be followed
788 by the name of a file whose date is compared against files found
789 on the share during a create. Only files newer than the file
790 specified are backed up to the tar file. Useful only with the
805 > - Set archive bit. Causes the
806 archive bit to be reset when a file is backed up. Useful with the
823 >Tar Long File Names</EM
829 >'s tar option now supports long
830 file names both on backup and restore. However, the full path
831 name of the file must be less than 1024 bytes. Also, when
832 a tar archive is created, smbclient's tar option places all
833 files in the archive with relative names, not absolute names.
840 >All file names can be given as DOS path names (with '\'
841 as the component separator) or as UNIX path names (with '/' as
842 the component separator). </P
848 >Restore from tar file backup.tar into myshare on mypc
849 (no password on share). </P
853 >smbclient //mypc/myshare "" -N -Tx backup.tar
857 >Restore everything except <TT
865 >smbclient //mypc/myshare "" -N -TXx backup.tar
869 >Create a tar file of the files beneath <TT
876 >smbclient //mypc/myshare "" -N -Tc
877 backup.tar users/docs </B
880 >Create the same tar file as above, but now use
885 >smbclient //mypc/myshare "" -N -tc backup.tar
889 >Create a tar file of all the files and directories in
894 >smbclient //mypc/myshare "" -N -Tc backup.tar *
899 >-D initial directory</DT
902 >Change to initial directory before starting. Probably
903 only of any use with the tar -T option. </P
906 >-c command string</DT
909 >command string is a semicolon separated list of
910 commands to be executed instead of prompting from stdin. <TT
922 >This is particularly useful in scripts and for printing stdin
923 to the server, e.g. <B
939 >Once the client is running, the user is presented with
947 >The backslash ("\") indicates the current working directory
948 on the server, and will change if the current working directory
951 >The prompt indicates that the client is ready and waiting to
952 carry out a user command. Each command is a single word, optionally
953 followed by parameters specific to that command. Command and parameters
954 are space-delimited unless these notes specifically
955 state otherwise. All commands are case-insensitive. Parameters to
956 commands may or may not be case sensitive, depending on the command.
959 >You can specify file names which have spaces in them by quoting
960 the name with double quotes, for example "a long file name". </P
962 >Parameters shown in square brackets (e.g., "[parameter]") are
963 optional. If not given, the command will use suitable defaults. Parameters
964 shown in angle brackets (e.g., "<parameter>") are required.
967 >Note that all commands operating on the server are actually
968 performed by issuing a request to the server. Thus the behavior may
969 vary from server to server, depending on how the server was implemented.
972 >The commands available are given here in alphabetical order. </P
982 >If "command" is specified, the ? command will display
983 a brief informative message about the specified command. If no
984 command is specified, a list of available commands will
988 >! [shell command]</DT
991 >If "shell command" is specified, the !
992 command will execute a shell locally and run the specified shell
993 command. If no command is specified, a local shell will be run.
997 >cd [directory name]</DT
1000 >If "directory name" is specified, the current
1001 working directory on the server will be changed to the directory
1002 specified. This operation will fail if for any reason the specified
1003 directory is inaccessible. </P
1005 >If no directory name is specified, the current working
1006 directory on the server will be reported. </P
1009 >del <mask></DT
1012 >The client will request that the server attempt
1013 to delete all files matching "mask" from the current working
1014 directory on the server. </P
1017 >dir <mask></DT
1020 >A list of the files matching "mask" in the current
1021 working directory on the server will be retrieved from the server
1028 >Terminate the connection with the server and exit
1029 from the program. </P
1032 >get <remote file name> [local file name]</DT
1035 >Copy the file called "remote file name" from
1036 the server to the machine running the client. If specified, name
1037 the local copy "local file name". Note that all transfers in
1041 > are binary. See also the
1042 lowercase command. </P
1048 >See the ? command above. </P
1051 >lcd [directory name]</DT
1054 >If "directory name" is specified, the current
1055 working directory on the local machine will be changed to
1056 the directory specified. This operation will fail if for any
1057 reason the specified directory is inaccessible. </P
1059 >If no directory name is specified, the name of the
1060 current working directory on the local machine will be reported.
1067 >Toggle lowercasing of filenames for the get and
1070 >When lowercasing is toggled ON, local filenames are converted
1071 to lowercase when using the get and mget commands. This is
1072 often useful when copying (say) MSDOS files from a server, because
1073 lowercase filenames are the norm on UNIX systems. </P
1076 >ls <mask></DT
1079 >See the dir command above. </P
1082 >mask <mask></DT
1085 >This command allows the user to set up a mask
1086 which will be used during recursive operation of the mget and
1089 >The masks specified to the mget and mput commands act as
1090 filters for directories rather than files when recursion is
1093 >The mask specified with the mask command is necessary
1094 to filter files within those directories. For example, if the
1095 mask specified in an mget command is "source*" and the mask
1096 specified with the mask command is "*.c" and recursion is
1097 toggled ON, the mget command will retrieve all files matching
1098 "*.c" in all directories below and including all directories
1099 matching "source*" in the current working directory. </P
1101 >Note that the value for mask defaults to blank (equivalent
1102 to "*") and remains so until the mask command is used to change it.
1103 It retains the most recently specified value indefinitely. To
1104 avoid unexpected results it would be wise to change the value of
1105 mask back to "*" after using the mget or mput commands. </P
1108 >md <directory name></DT
1111 >See the mkdir command. </P
1114 >mget <mask></DT
1117 >Copy all files matching mask from the server to
1118 the machine running the client. </P
1120 >Note that mask is interpreted differently during recursive
1121 operation and non-recursive operation - refer to the recurse and
1122 mask commands for more information. Note that all transfers in
1123 smbclient are binary. See also the lowercase command. </P
1126 >mkdir <directory name></DT
1129 >Create a new directory on the server (user access
1130 privileges permitting) with the specified name. </P
1133 >mput <mask></DT
1136 >Copy all files matching mask in the current working
1137 directory on the local machine to the current working directory on
1140 >Note that mask is interpreted differently during recursive
1141 operation and non-recursive operation - refer to the recurse and mask
1142 commands for more information. Note that all transfers in smbclient
1146 >print <file name></DT
1149 >Print the specified file from the local machine
1150 through a printable service on the server. </P
1152 >See also the printmode command.</P
1155 >printmode <graphics or text></DT
1158 >Set the print mode to suit either binary data
1159 (such as graphical information) or text. Subsequent print
1160 commands will use the currently set print mode. </P
1166 >Toggle prompting for filenames during operation
1167 of the mget and mput commands. </P
1169 >When toggled ON, the user will be prompted to confirm
1170 the transfer of each file during these commands. When toggled
1171 OFF, all specified files will be transferred without prompting.
1175 >put <local file name> [remote file name]</DT
1178 >Copy the file called "local file name" from the
1179 machine running the client to the server. If specified,
1180 name the remote copy "remote file name". Note that all transfers
1181 in smbclient are binary. See also the lowercase command.
1188 >Displays the print queue, showing the job id,
1189 name, size and current status. </P
1195 >See the exit command. </P
1198 >rd <directory name></DT
1201 >See the rmdir command. </P
1207 >Toggle directory recursion for the commands mget
1210 >When toggled ON, these commands will process all directories
1211 in the source directory (i.e., the directory they are copying
1212 from ) and will recurse into any that match the mask specified
1213 to the command. Only files that match the mask specified using
1214 the mask command will be retrieved. See also the mask command.
1217 >When recursion is toggled OFF, only files from the current
1218 working directory on the source machine that match the mask specified
1219 to the mget or mput commands will be copied, and any mask specified
1220 using the mask command will be ignored. </P
1223 >rm <mask></DT
1226 >Remove all files matching mask from the current
1227 working directory on the server. </P
1230 >rmdir <directory name></DT
1233 >Remove the specified directory (user access
1234 privileges permitting) from the server. </P
1237 >tar <c|x>[IXbgNa]</DT
1240 >Performs a tar operation - see the <TT
1246 > command line option above. Behavior may be affected
1247 by the tarmode command (see below). Using g (incremental) and N
1248 (newer) will affect tarmode settings. Note that using the "-" option
1249 with tar x may not work - use the command line option instead.
1253 >blocksize <blocksize></DT
1256 >Blocksize. Must be followed by a valid (greater
1257 than zero) blocksize. Causes tar file to be written out in
1258 blocksize*TBLOCK (usually 512 byte) blocks. </P
1261 >tarmode <full|inc|reset|noreset></DT
1264 >Changes tar's behavior with regard to archive
1265 bits. In full mode, tar will back up everything regardless of the
1266 archive bit setting (this is the default mode). In incremental mode,
1267 tar will only back up files with the archive bit set. In reset mode,
1268 tar will reset the archive bit on all files it backs up (implies
1269 read/write share). </P
1272 >setmode <filename> <perm=[+|\-]rsha></DT
1275 >A version of the DOS attrib command to set
1276 file permissions. For example: </P
1280 >setmode myfile +r </B
1283 >would make myfile read only. </P
1296 >Some servers are fussy about the case of supplied usernames,
1297 passwords, share names (AKA service names) and machine names.
1298 If you fail to connect try giving all parameters in uppercase.
1301 >It is often necessary to use the -n option when connecting
1302 to some types of servers. For example OS/2 LanManager insists
1303 on a valid NetBIOS name being used, so you need to supply a valid
1304 name that would be known to the server.</P
1306 >smbclient supports long file names where the server
1307 supports the LANMAN2 protocol or above. </P
1315 >ENVIRONMENT VARIABLES</H2
1323 username of the person using the client. This information is
1324 used only if the protocol level is high enough to support
1325 session-level passwords.</P
1333 the password of the person using the client. This information is
1334 used only if the protocol level is high enough to support
1335 session-level passwords. </P
1345 >The location of the client program is a matter for
1346 individual system administrators. The following are thus
1347 suggestions only. </P
1349 >It is recommended that the smbclient software be installed
1352 >/usr/local/samba/bin/</TT
1355 > /usr/samba/bin/</TT
1356 > directory, this directory readable
1357 by all, writeable only by root. The client program itself should
1358 be executable by all. The client should <EM
1361 setuid or setgid! </P
1363 >The client log files should be put in a directory readable
1364 and writeable only by the user. </P
1366 >To test the client, you will need to know the name of a
1367 running SMB/CIFS server. It is possible to run <B
1371 > an ordinary user - running that server as a daemon
1372 on a user-accessible port (typically any port number over 1024)
1373 would provide a suitable test server. </P
1383 >Most diagnostics issued by the client are logged in a
1384 specified log file. The log file name is specified at compile time,
1385 but may be overridden on the command line. </P
1387 >The number and nature of diagnostics available depends
1388 on the debug level used by the client. If you have problems,
1389 set the debug level to 3 and peruse the log files. </P
1399 >This man page is correct for version 2.2 of
1410 >The original Samba software and related utilities
1411 were created by Andrew Tridgell. Samba is now developed
1412 by the Samba Team as an Open Source project similar
1413 to the way the Linux kernel is developed.</P
1415 >The original Samba man pages were written by Karl Auer.
1416 The man page sources were converted to YODL format (another
1417 excellent piece of Open Source software, available at
1419 HREF="ftp://ftp.icce.rug.nl/pub/unix/"
1421 > ftp://ftp.icce.rug.nl/pub/unix/</A
1422 >) and updated for the Samba 2.0
1423 release by Jeremy Allison. The conversion to DocBook for
1424 Samba 2.2 was done by Gerald Carter</P