1 2 3 4 5 6 7<html><head><title>smbclient (1)</title> 8 9<link rev="made" href="mailto:samba@samba.org"> 10</head> 11<body> 12 13<hr> 14 15<h1>smbclient (1)</h1> 16<h2>Samba</h2> 17<h2>23 Oct 1998</h2> 18 19 20 21<p><a name="NAME"></a> 22<h2>NAME</h2> 23 smbclient - ftp-like client to access SMB/CIFS resources on servers 24<p><a name="SYNOPSIS"></a> 25<h2>SYNOPSIS</h2> 26 27<p><strong>smbclient</strong> <a href="smbclient.1.html#servicename">servicename</a> [<a href="smbclient.1.html#password">password</a>] [<a href="smbclient.1.html#minuss">-s smb.conf</a>] [<a href="smbclient.1.html#minusO">-O socket options</a>][<a href="smbclient.1.html#minusR">-R name resolve order</a>] [<a href="smbclient.1.html#minusM">-M NetBIOS name</a>] [<a href="smbclient.1.html#minusi">-i scope</a>] [<a href="smbclient.1.html#minusN">-N</a>] [<a href="smbclient.1.html#minusn">-n NetBIOS name</a>] [<a href="smbclient.1.html#minusd">-d debuglevel</a>] [<a href="smbclient.1.html#minusP">-P</a>] [<a href="smbclient.1.html#minusp">-p port</a>] [<a href="smbclient.1.html#minusl">-l log basename</a>] [<a href="smbclient.1.html#minush">-h</a>] [<a href="smbclient.1.html#minusI">-I dest IP</a>] [<a href="smbclient.1.html#minusE">-E</a>] [<a href="smbclient.1.html#minusU">-U username</a>] [<a href="smbclient.1.html#minusL">-L NetBIOS name</a>] [<a href="smbclient.1.html#minust">-t terminal code</a>] [<a href="smbclient.1.html#minusm">-m max protocol</a>] [<a href="smbclient.1.html#minusb">-b buffersize</a>] [<a href="smbclient.1.html#minusW">-W workgroup</a>] [<a href="smbclient.1.html#minusT">-T<c|x>IXFqgbNan</a>] [<a href="smbclient.1.html#minusD">-D directory</a>] [<a href="smbclient.1.html#minusc">-c command string</a>] 28<p><a name="DESCRIPTION"></a> 29<h2>DESCRIPTION</h2> 30 31<p>This program is part of the <strong>Samba</strong> suite. 32<p><strong>smbclient</strong> is a client that can 'talk' to an SMB/CIFS server. It 33offers an interface similar to that of the ftp program (see <strong>ftp 34(1)</strong>). Operations include things like getting files from the server 35to the local machine, putting files from the local machine to the 36server, retrieving directory information from the server and so on. 37<p><a name="OPTIONS"></a> 38<h2>OPTIONS</h2> 39 40<p><dl> 41<p><a name="servicename"></a> 42<p></p><dt><strong><strong>servicename</strong></strong><dd> servicename is the name of the service you want 43to use on the server. A service name takes the form 44<code>//server/service</code> where <em>server</em> is the NetBIOS name of the SMB/CIFS 45server offering the desired service and <em>service</em> is the name 46of the service offered. Thus to connect to the service <em>printer</em> on 47the SMB/CIFS server <em>smbserver</em>, you would use the servicename 48<p><code>//smbserver/printer</code> 49<p>Note that the server name required is NOT necessarily the IP (DNS) 50host name of the server ! The name required is a NetBIOS server name, 51which may or may not be the same as the IP hostname of the machine 52running the server. 53<p>The server name is looked up according to either the 54<a href="smbclient.1.html#minusR"><strong>-R</strong></a> parameter to <strong>smbclient</strong> or using the 55<a href="smb.conf.5.html#nameresolveorder"><strong>name resolve order</strong></a> 56parameter in the smb.conf file, allowing an administrator to change 57the order and methods by which server names are looked up. 58<p><a name="password"></a> 59<p></p><dt><strong><strong>password</strong></strong><dd> password is the password required to access the 60specified service on the specified server. If this parameter is 61supplied, the <a href="smbclient.1.html#minusN"><strong>-N</strong></a> option (suppress password prompt) is assumed. 62<p>There is no default password. If no password is supplied on the 63command line (either by using this parameter or adding a password to 64the <a href="smbclient.1.html#minusU"><strong>-U</strong></a> option (see below)) and the <a href="smbclient.1.html#minusN"><strong>-N</strong></a> option is not specified, 65the client will prompt for a password, even if the desired service 66does not require one. (If no password is required, simply press ENTER 67to provide a null password.) 68<p>Note: Some servers (including OS/2 and Windows for Workgroups) insist 69on an uppercase password. Lowercase or mixed case passwords may be 70rejected by these servers. 71<p>Be cautious about including passwords in scripts. 72<p><a name="minuss"></a> 73<p></p><dt><strong><strong>-s smb.conf</strong></strong><dd> This parameter specifies the pathname to the 74Samba configuration file, smb.conf. This file controls all aspects of 75the Samba setup on the machine and smbclient also needs to read this 76file. 77<p><a name="minusO"></a> 78<p></p><dt><strong><strong>-O socket options</strong></strong><dd> TCP socket options to set on the client 79socket. See the <a href="smb.conf.5.html#socketoptions">socket options</a> 80parameter in the <a href="smb.conf.5.html"><strong>smb.conf (5)</strong></a> manpage for 81the list of valid options. 82<p><a name="minusR"></a> 83<p></p><dt><strong><strong>-R name resolve order</strong></strong><dd> This option allows the user of 84smbclient to determine what name resolution services to use when 85looking up the NetBIOS name of the host being connected to. 86<p>The options are :"lmhosts", "host", "wins" and "bcast". They cause 87names to be resolved as follows : 88<p><dl> 89<p><li > <strong>lmhosts</strong> : Lookup an IP address in the Samba lmhosts file. 90The lmhosts file is stored in the same directory as the 91<a href="smb.conf.5.html"><strong>smb.conf</strong></a> file. 92<p><li > <strong>host</strong> : Do a standard host name to IP address resolution, 93using the system /etc/hosts, NIS, or DNS lookups. This method of name 94resolution is operating system depended for instance on IRIX or 95Solaris this may be controlled by the <em>/etc/nsswitch.conf</em> file). 96<p><li > <strong>wins</strong> : Query a name with the IP address listed in the <a href="smb.conf.5.html#winsserver"><strong>wins 97server</strong></a> parameter in the smb.conf file. If 98no WINS server has been specified this method will be ignored. 99<p><li > <strong>bcast</strong> : Do a broadcast on each of the known local interfaces 100listed in the <a href="smb.conf.5.html#interfaces"><strong>interfaces</strong></a> parameter 101in the smb.conf file. This is the least reliable of the name resolution 102methods as it depends on the target host being on a locally connected 103subnet. 104<p></dl> 105<p>If this parameter is not set then the name resolve order defined 106in the <a href="smb.conf.5.html"><strong>smb.conf</strong></a> file parameter 107<a href="smb.conf.5.html#nameresolveorder">(<strong>name resolve order</strong>)</a> 108will be used. 109<p>The default order is lmhosts, host, wins, bcast and without this 110parameter or any entry in the <a href="smb.conf.5.html#nameresolveorder"><strong>"name resolve 111order"</strong></a> parameter of the 112<a href="smb.conf.5.html"><strong>smb.conf</strong></a> file the name resolution methods 113will be attempted in this order. 114<p><a name="minusM"></a> 115<p></p><dt><strong><strong>-M NetBIOS name</strong></strong><dd> This options allows you to send messages, 116using the "WinPopup" protocol, to another computer. Once a connection 117is established you then type your message, pressing ^D (control-D) to 118end. 119<p>If the receiving computer is running WinPopup the user will receive 120the message and probably a beep. If they are not running WinPopup the 121message will be lost, and no error message will occur. 122<p>The message is also automatically truncated if the message is over 1231600 bytes, as this is the limit of the protocol. 124<p>One useful trick is to cat the message through <strong>smbclient</strong>. 125For example: 126<p><code>cat mymessage.txt | smbclient -M FRED</code> 127<p>will send the message in the file <em>mymessage.txt</em> to the machine FRED. 128<p>You may also find the <a href="smbclient.1.html#minusU"><strong>-U</strong></a> and <a href="smbclient.1.html#minusI"><strong>-I</strong></a> options useful, as they allow 129you to control the FROM and TO parts of the message. 130<p>See the <a href="smb.conf.5.html#messagecommand"><strong>message command</strong></a> 131parameter in the <strong>smb.conf (5)</strong> for a description of how to handle 132incoming WinPopup messages in Samba. 133<p>Note: Copy WinPopup into the startup group on your WfWg PCs if you 134want them to always be able to receive messages. 135<p><a name="minusi"></a> 136<p></p><dt><strong><strong>-i scope</strong></strong><dd> This specifies a NetBIOS scope that smbclient will use 137to communicate with when generating NetBIOS names. For details on the 138use of NetBIOS scopes, see rfc1001.txt and rfc1002.txt. NetBIOS scopes 139are <em>very</em> rarely used, only set this parameter if you are the 140system administrator in charge of all the NetBIOS systems you 141communicate with. 142<p><a name="minusN"></a> 143<p></p><dt><strong><strong>-N</strong></strong><dd> If specified, this parameter suppresses the normal 144password prompt from the client to the user. This is useful when 145accessing a service that does not require a password. 146<p>Unless a password is specified on the command line or this parameter 147is specified, the client will request a password. 148<p><a name="minusn"></a> 149<p></p><dt><strong><strong>-n NetBIOS name</strong></strong><dd> By default, the client will use the local 150machine's hostname (in uppercase) as its NetBIOS name. This parameter 151allows you to override the host name and use whatever NetBIOS name you 152wish. 153<p><a name="minusd"></a> 154<p></p><dt><strong><strong>-d debuglevel</strong></strong><dd> debuglevel is an integer from 0 to 10, or the 155letter 'A'. 156<p>The default value if this parameter is not specified is zero. 157<p>The higher this value, the more detail will be logged to the log files 158about the activities of the client. At level 0, only critical errors 159and serious warnings will be logged. Level 1 is a reasonable level for 160day to day running - it generates a small amount of information about 161operations carried out. 162<p>Levels above 1 will generate considerable amounts of log data, and 163should only be used when investigating a problem. Levels above 3 are 164designed for use only by developers and generate HUGE amounts of log 165data, most of which is extremely cryptic. If debuglevel is set to the 166letter 'A', then <em>all</em> debug messages will be printed. This setting 167is for developers only (and people who <em>really</em> want to know how the 168code works internally). 169<p>Note that specifying this parameter here will override the <a href="smb.conf.5.html#loglevel"><strong>log 170level</strong></a> parameter in the <a href="smb.conf.5.html"><strong>smb.conf 171(5)</strong></a> file. 172<p><a name="minusP"></a> 173<p></p><dt><strong><strong>-P</strong></strong><dd> This option is no longer used. The code in Samba2.0 174now lets the server decide the device type, so no printer specific 175flag is needed. 176<p><a name="minusp"></a> 177<p></p><dt><strong><strong>-p port</strong></strong><dd> This number is the TCP port number that will be used 178when making connections to the server. The standard (well-known) TCP 179port number for an SMB/CIFS server is 139, which is the default. 180<p><a name="minusl"></a> 181<p></p><dt><strong><strong>-l logfilename</strong></strong><dd> If specified, logfilename specifies a base 182filename into which operational data from the running client will be 183logged. 184<p>The default base name is specified at compile time. 185<p>The base name is used to generate actual log file names. For example, 186if the name specified was "log", the debug file would be 187<code>log.client</code>. 188<p>The log file generated is never removed by the client. 189<p><a name="minush"></a> 190<p></p><dt><strong><strong>-h</strong></strong><dd> Print the usage message for the client. 191<p><a name="minusI"></a> 192<p></p><dt><strong><strong>-I IP address</strong></strong><dd> IP address is the address of the server to 193connect to. It should be specified in standard "a.b.c.d" notation. 194<p>Normally the client would attempt to locate a named SMB/CIFS server by 195looking it up via the NetBIOS name resolution mechanism described 196above in the <a href="smbclient.1.html#minusR"><strong>name resolve order</strong></a> parameter 197above. Using this parameter will force the client to assume that the 198server is on the machine with the specified IP address and the NetBIOS 199name component of the resource being connected to will be ignored. 200<p>There is no default for this parameter. If not supplied, it will be 201determined automatically by the client as described above. 202<p><a name="minusE"></a> 203<p></p><dt><strong><strong>-E</strong></strong><dd> This parameter causes the client to write messages to the 204standard error stream (stderr) rather than to the standard output 205stream. 206<p>By default, the client writes messages to standard output - typically 207the user's tty. 208<p><a name="minusU"></a> 209<p></p><dt><strong><strong>-U username</strong></strong><dd> This specifies the user name that will be used by 210the client to make a connection, assuming your server is not a downlevel 211server that is running a protocol level that uses passwords on shares, 212not on usernames. 213<p>Some servers are fussy about the case of this name, and some insist 214that it must be a valid NetBIOS name. 215<p>If no username is supplied, it will default to an uppercase version of 216the environment variable <code>USER</code> or <code>LOGNAME</code> in that order. If no 217username is supplied and neither environment variable exists the 218username "GUEST" will be used. 219<p>If the <code>USER</code> environment variable contains a '%' character, 220everything after that will be treated as a password. This allows you 221to set the environment variable to be <code>USER=username%password</code> so 222that a password is not passed on the command line (where it may be 223seen by the ps command). 224<p>If the service you are connecting to requires a password, it can be 225supplied using the <a href="smbclient.1.html#minusU"><strong>-U</strong></a> option, by appending a percent symbol ("%") 226then the password to username. For example, to attach to a service as 227user <code>"fred"</code> with password <code>"secret"</code>, you would specify. <br> 228<p><code>-U fred%secret</code> <br> 229<p>on the command line. Note that there are no spaces around the percent 230symbol. 231<p>If you specify the password as part of username then the <a href="smbclient.1.html#minusN"><strong>-N</strong></a> option 232(suppress password prompt) is assumed. 233<p>If you specify the password as a parameter <em>AND</em> as part of username 234then the password as part of username will take precedence. Putting 235nothing before or nothing after the percent symbol will cause an empty 236username or an empty password to be used, respectively. 237<p>The password may also be specified by setting up an environment 238variable called <code>PASSWD</code> that contains the users password. Note 239that this may be very insecure on some systems but on others allows 240users to script smbclient commands without having a password appear in 241the command line of a process listing. 242<p>Note: Some servers (including OS/2 and Windows for Workgroups) insist 243on an uppercase password. Lowercase or mixed case passwords may be 244rejected by these servers. 245<p>Be cautious about including passwords in scripts or in the 246<code>PASSWD</code> environment variable. Also, on many systems the command 247line of a running process may be seen via the <code>ps</code> command to be 248safe always allow smbclient to prompt for a password and type it in 249directly. 250<p><a name="minusL"></a> 251<p></p><dt><strong><strong>-L</strong></strong><dd> This option allows you to look at what services are 252available on a server. You use it as <code>"smbclient -L host"</code> and a 253list should appear. The <a href="smbclient.1.html#minusI"><strong>-I</strong></a> option may be useful if your NetBIOS 254names don't match your tcp/ip dns host names or if you are trying to 255reach a host on another network. 256<p><a name="minust"></a> 257<p></p><dt><strong><strong>-t terminal code</strong></strong><dd> This option tells smbclient how to interpret 258filenames coming from the remote server. Usually Asian language 259multibyte UNIX implementations use different character sets than 260SMB/CIFS servers (<em>EUC</em> instead of <em>SJIS</em> for example). Setting 261this parameter will let smbclient convert between the UNIX filenames 262and the SMB filenames correctly. This option has not been seriously 263tested and may have some problems. 264<p>The terminal codes include <code>sjis</code>, <code>euc</code>, <code>jis7</code>, <code>jis8</code>, 265<code>junet</code>, <code>hex</code>, <code>cap</code>. This is not a complete list, check the 266Samba source code for the complete list. 267<p><a name="minusm"></a> 268<p></p><dt><strong><strong>-m max protocol level</strong></strong><dd> With the new code in Samba2.0, 269<strong>smbclient</strong> always attempts to connect at the maximum 270protocols level the server supports. This parameter is 271preserved for backwards compatibility, but any string 272following the <strong>-m</strong> will be ignored. 273<p><a name="minusb"></a> 274<p></p><dt><strong><strong>-b buffersize</strong></strong><dd> This option changes the transmit/send buffer 275size when getting or putting a file from/to the server. The default 276is 65520 bytes. Setting this value smaller (to 1200 bytes) has been 277observed to speed up file transfers to and from a Win9x server. 278<p><a name="minusW"></a> 279<p></p><dt><strong><strong>-W WORKGROUP</strong></strong><dd> Override the default workgroup specified in the 280<a href="smb.conf.5.html#workgroup"><strong>workgroup</strong></a> parameter of the 281<a href="smb.conf.5.html"><strong>smb.conf</strong></a> file for this connection. This may 282be needed to connect to some servers. 283<p><a name="minusT"></a> <p></p><dt><strong><strong>-T tar options</strong></strong><dd> smbclient may be used to create 284<strong>tar (1)</strong> compatible backups of all the files on an SMB/CIFS 285share. The secondary tar flags that can be given to this option are : 286<p><dl> 287<p><p></p><dt><strong><strong>c</strong></strong><dd> Create a tar file on UNIX. Must be followed by the 288 name of a tar file, tape device or <code>"-"</code> for standard output. If 289 using standard output you must turn the log level to its lowest value 290 <code>-d0</code> to avoid corrupting your tar file. This flag is 291 mutually exclusive with the <strong>x</strong> flag. 292<p><p></p><dt><strong><strong>x</strong></strong><dd> Extract (restore) a local tar file back to a 293 share. Unless the <a href="smbclient.1.html#minusD"><strong>-D</strong></a> option is given, the tar files will be 294 restored from the top level of the share. Must be followed by the name 295 of the tar file, device or <code>"-"</code> for standard input. Mutually exclusive 296 with the <strong>c</strong> flag. Restored files have their creation times (mtime) 297 set to the date saved in the tar file. Directories currently do not 298 get their creation dates restored properly. 299<p><p></p><dt><strong><strong>I</strong></strong><dd> Include files and directories. Is the default 300 behavior when filenames are specified above. Causes tar files to 301 be included in an extract or create (and therefore everything else to 302 be excluded). See example below. Filename globbing works 303 in one of two ways. See <strong>r</strong> below. 304<p><p></p><dt><strong><strong>X</strong></strong><dd> Exclude files and directories. Causes tar files to 305 be excluded from an extract or create. See example below. Filename 306 globbing works in one of two ways now. See <strong>r</strong> below. 307<p><p></p><dt><strong><strong>b</strong></strong><dd> Blocksize. Must be followed by a valid (greater than 308 zero) blocksize. Causes tar file to be written out in 309 blocksize*TBLOCK (usually 512 byte) blocks. 310<p><p></p><dt><strong><strong>g</strong></strong><dd> Incremental. Only back up files that have the 311 archive bit set. Useful only with the <strong>c</strong> flag. 312<p><p></p><dt><strong><strong>q</strong></strong><dd> Quiet. Keeps tar from printing diagnostics as it 313 works. This is the same as tarmode quiet. 314<p><p></p><dt><strong><strong>r</strong></strong><dd> Regular expression include or exclude. Uses regular 315 regular expression matching for excluding or excluding files if 316 compiled with HAVE_REGEX_H. However this mode can be very slow. If 317 not compiled with HAVE_REGEX_H, does a limited wildcard match on * and 318 ?. 319<p><p></p><dt><strong><strong>N</strong></strong><dd> Newer than. Must be followed by the name of a file 320 whose date is compared against files found on the share during a 321 create. Only files newer than the file specified are backed up to the 322 tar file. Useful only with the <strong>c</strong> flag. 323<p><p></p><dt><strong><strong>a</strong></strong><dd> Set archive bit. Causes the archive bit to be reset 324 when a file is backed up. Useful with the <strong>g</strong> and <strong>c</strong> flags. 325<p></dl> 326<p><em>Tar Long File Names</em> 327<p>smbclient's tar option now supports long file names both on backup and 328restore. However, the full path name of the file must be less than 3291024 bytes. Also, when a tar archive is created, smbclient's tar 330option places all files in the archive with relative names, not 331absolute names. 332<p><em>Tar Filenames</em> 333<p>All file names can be given as DOS path names (with <code>\</code> as the 334component separator) or as UNIX path names (with <code>/</code> as the 335component separator). 336<p><em>Examples</em> 337<p><dl> 338<p><li > Restore from tar file backup.tar into myshare on mypc (no password on share). 339<p><code>smbclient //mypc/myshare "" -N -Tx backup.tar</code> 340<p><li > Restore everything except users/docs 341<p><code>smbclient //mypc/myshare "" -N -TXx backup.tar users/docs</code> 342<p><li > Create a tar file of the files beneath users/docs. 343<p><code>smbclient //mypc/myshare "" -N -Tc backup.tar users/docs</code> 344<p><li > Create the same tar file as above, but now use a DOS path name. 345<p><code>smbclient //mypc/myshare "" -N -tc backup.tar users\edocs</code> 346<p><li > Create a tar file of all the files and directories in the share. 347<p><code>smbclient //mypc/myshare "" -N -Tc backup.tar *</code> 348<p></dl> 349<p><a name="minusD"></a> 350<p></p><dt><strong><strong>-D initial directory</strong></strong><dd> Change to initial directory before 351starting. Probably only of any use with the tar <a href="smbclient.1.html#minusT"><strong>-T</strong></a> option. 352<p><a name="minusc"></a> 353<p></p><dt><strong><strong>-c command string</strong></strong><dd> command string is a semicolon separated 354list of commands to be executed instead of prompting from stdin. 355<a href="smbclient.1.html#minusN"><strong>-N</strong></a> is implied by <strong>-c</strong>. 356<p>This is particularly useful in scripts and for printing stdin to the 357server, e.g. <code>-c 'print -'</code>. 358<p></dl> 359<p><a name="OPERATIONS"></a> 360<h2>OPERATIONS</h2> 361 362<p>Once the client is running, the user is presented with a prompt : 363<p><code>smb:\></code> 364<p>The backslash ("\") indicates the current working directory on the 365server, and will change if the current working directory is changed. 366<p>The prompt indicates that the client is ready and waiting to carry out 367a user command. Each command is a single word, optionally followed by 368parameters specific to that command. Command and parameters are 369space-delimited unless these notes specifically state otherwise. All 370commands are case-insensitive. Parameters to commands may or may not 371be case sensitive, depending on the command. 372<p>You can specify file names which have spaces in them by quoting the 373name with double quotes, for example "a long file name". 374<p>Parameters shown in square brackets (e.g., "[parameter]") are 375optional. If not given, the command will use suitable 376defaults. Parameters shown in angle brackets (e.g., "<parameter>") are 377required. 378<p>Note that all commands operating on the server are actually performed 379by issuing a request to the server. Thus the behavior may vary from 380server to server, depending on how the server was implemented. 381<p>The commands available are given here in alphabetical order. 382<p><dl> 383<p><a name="questionmark"></a> <p></p><dt><strong><strong>? [command]</strong></strong><dd> If "command" is specified, 384the <strong>?</strong> command will display a brief informative message about the 385specified command. If no command is specified, a list of available 386commands will be displayed. 387<p><a name="exclaimationmark"></a> <p></p><dt><strong><strong>! [shell command]</strong></strong><dd> If "shell command" 388is specified, the <strong>!</strong> command will execute a shell locally and run 389the specified shell command. If no command is specified, a local shell 390will be run. 391<p><a name="cd"></a> <p></p><dt><strong><strong>cd [directory name]</strong></strong><dd> If "directory name" is 392specified, the current working directory on the server will be changed 393to the directory specified. This operation will fail if for any reason 394the specified directory is inaccessible. 395<p>If no directory name is specified, the current working directory on 396the server will be reported. 397<p><a name="del"></a> <p></p><dt><strong><strong>del <mask></strong></strong><dd> The client will request that the server 398attempt to delete all files matching "mask" from the current working 399directory on the server. 400<p><a name="dir"></a> <p></p><dt><strong><strong>dir <mask></strong></strong><dd> A list of the files matching "mask" in 401the current working directory on the server will be retrieved from the 402server and displayed. 403<p><a name="exit"></a> <p></p><dt><strong><strong>exit</strong></strong><dd> Terminate the connection with the server and 404exit from the program. 405<p><a name="get"></a> <p></p><dt><strong><strong>get <remote file name> [local file name]</strong></strong><dd> Copy the 406file called "remote file name" from the server to the machine running 407the client. If specified, name the local copy "local file name". Note 408that all transfers in smbclient are binary. See also the 409<a href="smbclient.1.html#lowercase"><strong>lowercase</strong></a> command. 410<p><a name="help"></a> <p></p><dt><strong><strong>help [command]</strong></strong><dd> See the <a href="smbclient.1.html#questionmark"><strong>?</strong></a> 411command above. 412<p><a name="lcd"></a> <p></p><dt><strong><strong>lcd [directory name]</strong></strong><dd> If "directory name" is 413specified, the current working directory on the local machine will 414be changed to the directory specified. This operation will fail if for 415any reason the specified directory is inaccessible. 416<p>If no directory name is specified, the name of the current working 417directory on the local machine will be reported. 418<p><a name="lowercase"></a> <p></p><dt><strong><strong>lowercase</strong></strong><dd> Toggle lowercasing of filenames 419for the <a href="smbclient.1.html#get"><strong>get</strong></a> and <a href="smbclient.1.html#mget"><strong>mget</strong></a> commands. 420<p>When lowercasing is toggled ON, local filenames are converted to 421lowercase when using the <a href="smbclient.1.html#get"><strong>get</strong></a> and <a href="smbclient.1.html#mget"><strong>mget</strong></a> 422commands. This is often useful when copying (say) MSDOS files from a 423server, because lowercase filenames are the norm on UNIX systems. 424<p><a name="ls"></a> <p></p><dt><strong><strong>ls <mask></strong></strong><dd> See the <a href="smbclient.1.html#dir"><strong>dir</strong></a> command above. 425<p><a name="mask"></a> <p></p><dt><strong><strong>mask <mask></strong></strong><dd> This command allows the user to set 426up a mask which will be used during recursive operation of the 427<a href="smbclient.1.html#mget"><strong>mget</strong></a> and <a href="smbclient.1.html#mput"><strong>mput</strong></a> commands. 428<p>The masks specified to the <a href="smbclient.1.html#mget"><strong>mget</strong></a> and 429<a href="smbclient.1.html#mput"><strong>mput</strong></a> commands act as filters for directories rather 430than files when recursion is toggled ON. 431<p>The mask specified with the .B mask command is necessary to filter 432files within those directories. For example, if the mask specified in 433an <a href="smbclient.1.html#mget"><strong>mget</strong></a> command is "source*" and the mask specified 434with the mask command is "*.c" and recursion is toggled ON, the 435<a href="smbclient.1.html#mget"><strong>mget</strong></a> command will retrieve all files matching "*.c" in 436all directories below and including all directories matching "source*" 437in the current working directory. 438<p>Note that the value for mask defaults to blank (equivalent to "*") and 439remains so until the mask command is used to change it. It retains the 440most recently specified value indefinitely. To avoid unexpected 441results it would be wise to change the value of .I mask back to "*" 442after using the <a href="smbclient.1.html#mget"><strong>mget</strong></a> or <a href="smbclient.1.html#mput"><strong>mput</strong></a> commands. 443<p><a name="md"></a> <p></p><dt><strong><strong>md <directory name></strong></strong><dd> See the <a href="smbclient.1.html#mkdir"><strong>mkdir</strong></a> 444command. 445<p><a name="mget"></a> <p></p><dt><strong><strong>mget <mask></strong></strong><dd> Copy all files matching mask from the 446server to the machine running the client. 447<p>Note that mask is interpreted differently during recursive operation 448and non-recursive operation - refer to the <a href="smbclient.1.html#recurse"><strong>recurse</strong></a> 449and <a href="smbclient.1.html#mask"><strong>mask</strong></a> commands for more information. Note that all 450transfers in .B smbclient are binary. See also the 451<a href="smbclient.1.html#lowercase"><strong>lowercase</strong></a> command. 452<p><a name="mkdir"></a> <p></p><dt><strong><strong>mkdir <directory name></strong></strong><dd> Create a new directory on 453the server (user access privileges permitting) with the specified 454name. 455<p><a name="mput"></a> <p></p><dt><strong><strong>mput <mask></strong></strong><dd> Copy all files matching mask in 456the current working directory on the local machine to the current 457working directory on the server. 458<p>Note that mask is interpreted differently during recursive operation 459and non-recursive operation - refer to the <a href="smbclient.1.html#recurse"><strong>recurse</strong></a> 460and <a href="smbclient.1.html#mask"><strong>mask</strong></a> commands for more information. Note that all 461transfers in .B smbclient are binary. 462<p><a name="print"></a> <p></p><dt><strong><strong>print <file name></strong></strong><dd> Print the specified file 463from the local machine through a printable service on the server. 464<p>See also the <a href="smbclient.1.html#printmode"><strong>printmode</strong></a> command. 465<p><a name="printmode"></a> <p></p><dt><strong><strong>printmode <graphics or text></strong></strong><dd> Set the print 466mode to suit either binary data (such as graphical information) or 467text. Subsequent print commands will use the currently set print 468mode. 469<p><a name="prompt"></a> <p></p><dt><strong><strong>prompt</strong></strong><dd> Toggle prompting for filenames during 470operation of the <a href="smbclient.1.html#mget"><strong>mget</strong></a> and <a href="smbclient.1.html#mput"><strong>mput</strong></a> 471commands. 472<p>When toggled ON, the user will be prompted to confirm the transfer of 473each file during these commands. When toggled OFF, all specified files 474will be transferred without prompting. 475<p><a name="put"></a> <p></p><dt><strong><strong>put <local file name> [remote file name]</strong></strong><dd> Copy the 476file called "local file name" from the machine running the client to 477the server. If specified, name the remote copy "remote file name". 478Note that all transfers in smbclient are binary. See also the 479<a href="smbclient.1.html#lowercase"><strong>lowercase</strong></a> command. 480<p><a name="queue"></a> <p></p><dt><strong><strong>queue</strong></strong><dd> Displays the print queue, showing the job 481id, name, size and current status. 482<p><a name="quit"></a> <p></p><dt><strong><strong>quit</strong></strong><dd> See the <a href="smbclient.1.html#exit"><strong>exit</strong></a> command. 483<p><a name="rd"></a> <p></p><dt><strong><strong>rd <directory name></strong></strong><dd> See the <a href="smbclient.1.html#rmdir"><strong>rmdir</strong></a> 484command. 485<p><a name="recurse"></a> <p></p><dt><strong><strong>recurse</strong></strong><dd> Toggle directory recursion for the 486commands <a href="smbclient.1.html#mget"><strong>mget</strong></a> and <a href="smbclient.1.html#mput"><strong>mput</strong></a>. 487<p>When toggled ON, these commands will process all directories in the 488source directory (i.e., the directory they are copying .IR from ) and 489will recurse into any that match the mask specified to the 490command. Only files that match the mask specified using the 491<a href="smbclient.1.html#mask"><strong>mask</strong></a> command will be retrieved. See also the 492<a href="smbclient.1.html#mask"><strong>mask</strong></a> command. 493<p>When recursion is toggled OFF, only files from the current working 494directory on the source machine that match the mask specified to the 495<a href="smbclient.1.html#mget"><strong>mget</strong></a> or <a href="smbclient.1.html#mput"><strong>mput</strong></a> commands will be copied, 496and any mask specified using the <a href="smbclient.1.html#mask"><strong>mask</strong></a> command will be 497ignored. 498<p><a name="rm"></a> <p></p><dt><strong><strong>rm <mask></strong></strong><dd> Remove all files matching mask from 499the current working directory on the server. 500<p><a name="rmdir"></a> <p></p><dt><strong><strong>rmdir <directory name></strong></strong><dd> Remove the specified 501directory (user access privileges permitting) from the server. 502<p><a name="tar"></a> <p></p><dt><strong><strong>tar <c|x>[IXbgNa]</strong></strong><dd> Performs a tar operation - see 503the <a href="smbclient.1.html#minusT"><strong>-T</strong></a> command line option above. Behavior may be 504affected by the <a href="smbclient.1.html#tarmode"><strong>tarmode</strong></a> command (see below). Using 505g (incremental) and N (newer) will affect tarmode settings. Note that 506using the "-" option with tar x may not work - use the command line 507option instead. 508<p><a name="blocksize"></a> <p></p><dt><strong><strong>blocksize <blocksize></strong></strong><dd> Blocksize. Must be 509followed by a valid (greater than zero) blocksize. Causes tar file to 510be written out in blocksize*TBLOCK (usually 512 byte) blocks. 511<p><a name="tarmode"></a> <p></p><dt><strong><strong>tarmode <full|inc|reset|noreset></strong></strong><dd> Changes tar's 512behavior with regard to archive bits. In full mode, tar will back up 513everything regardless of the archive bit setting (this is the default 514mode). In incremental mode, tar will only back up files with the 515archive bit set. In reset mode, tar will reset the archive bit on all 516files it backs up (implies read/write share). 517<p><a name="setmode"></a> <p></p><dt><strong><strong>setmode <filename> <perm=[+|\-]rsha></strong></strong><dd> A version 518of the DOS attrib command to set file permissions. For example: 519<p><code>setmode myfile +r</code> 520<p>would make myfile read only. 521<p></dl> 522<p><a name="NOTES"></a> 523<h2>NOTES</h2> 524 525<p>Some servers are fussy about the case of supplied usernames, 526passwords, share names (AKA service names) and machine names. If you 527fail to connect try giving all parameters in uppercase. 528<p>It is often necessary to use the <a href="smbclient.1.html#minusn"><strong>-n</strong></a> option when connecting to some 529types of servers. For example OS/2 LanManager insists on a valid 530NetBIOS name being used, so you need to supply a valid name that would 531be known to the server. 532<p>smbclient supports long file names where the server supports the 533LANMAN2 protocol or above. 534<p><a name="ENVIRONMENTVARIABLES"></a> 535<h2>ENVIRONMENT VARIABLES</h2> 536 537<p>The variable <strong>USER</strong> may contain the username of the person using the 538client. This information is used only if the protocol level is high 539enough to support session-level passwords. 540<p>The variable <strong>PASSWD</strong> may contain the password of the person using 541the client. This information is used only if the protocol level is 542high enough to support session-level passwords. 543<p><a name="INSTALLATION"></a> 544<h2>INSTALLATION</h2> 545 546<p>The location of the client program is a matter for individual system 547administrators. The following are thus suggestions only. 548<p>It is recommended that the smbclient software be installed in the 549/usr/local/samba/bin or /usr/samba/bin directory, this directory 550readable by all, writeable only by root. The client program itself 551should be executable by all. The client should <em>NOT</em> be setuid or 552setgid! 553<p>The client log files should be put in a directory readable and 554writeable only by the user. 555<p>To test the client, you will need to know the name of a running 556SMB/CIFS server. It is possible to run <a href="smbd.8.html"><strong>smbd (8)</strong></a> 557an ordinary user - running that server as a daemon on a 558user-accessible port (typically any port number over 1024) would 559provide a suitable test server. 560<p><a name="DIAGNOSTICS"></a> 561<h2>DIAGNOSTICS</h2> 562 563<p>Most diagnostics issued by the client are logged in a specified log 564file. The log file name is specified at compile time, but may be 565overridden on the command line. 566<p>The number and nature of diagnostics available depends on the debug 567level used by the client. If you have problems, set the debug level to 5683 and peruse the log files. 569<p><a name="VERSION"></a> 570<h2>VERSION</h2> 571 572<p>This man page is correct for version 2.0 of the Samba suite. 573<p><a name="AUTHOR"></a> 574<h2>AUTHOR</h2> 575 576<p>The original Samba software and related utilities were created by 577Andrew Tridgell <a href="mailto:samba@samba.org"><em>samba@samba.org</em></a>. Samba is now developed 578by the Samba Team as an Open Source project similar to the way the 579Linux kernel is developed. 580<p>The original Samba man pages were written by Karl Auer. The man page 581sources were converted to YODL format (another excellent piece of Open 582Source software, available at 583<a href="ftp://ftp.icce.rug.nl/pub/unix/"><strong>ftp://ftp.icce.rug.nl/pub/unix/</strong></a>) 584and updated for the Samba2.0 release by Jeremy Allison. 585<a href="mailto:samba@samba.org"><em>samba@samba.org</em></a>. 586<p>See <a href="samba.7.html"><strong>samba (7)</strong></a> to find out how to get a full 587list of contributors and details on how to submit bug reports, 588comments etc. 589</body> 590</html> 591