1 .TH SMBCLIENT 1 17/1/1995 smbclient smbclient
3 smbclient \- ftp-like Lan Manager client program
50 This program is part of the Samba suite.
53 is a client that can 'talk' to a Lan Manager server. It offers
54 an interface similar to that of the
57 .B ftp(1)). Operations include things like getting files from the
58 server to the local machine, putting files from the local machine to
59 the server, retrieving directory information from the server and so on.
65 is the name of the service you want to use on the server. A service
67 .B "\\\\\\\\server\\\\service"
70 is the netbios name of the Lan Manager server offering the desired service and
72 is the name of the service offered. Thus to connect to the service "printer"
73 on the Lan Manager server "lanman", you would use the servicename
76 .B "\\\\\\\\lanman\\\\printer"
79 Note that the server name required is NOT necessarily the host name of the
80 server! The name required is a Lan Manager server name, which may or may not
81 be the same as the hostname of the machine running the server.
88 is the password required to access the specified service on the
89 specified server. If supplied, the
91 option (suppress password prompt) is assumed.
93 There is no default password. If no password is supplied on the command line
94 (either here or using the
96 option (see below)) and
98 is not specified, the client will prompt for a password, even if the desired
99 service does not require one. (If prompted for a password and none is
100 required, simply press ENTER to provide a null password.)
102 Note: Some servers (including OS/2 and Windows for Workgroups) insist
103 on an uppercase password. Lowercase or mixed case passwords may be
104 rejected by these servers.
106 Be cautious about including passwords in scripts.
112 This parameter, if specified, causes the maximum debug level to be selected.
113 Be warned that this generates prodigious amounts of debug data. There is also
114 a security issue involved, as at the maximum debug level cleartext passwords
115 may be written to some log files.
121 This option allows you to look at what services are available on a
122 server. You use it as "smbclient -L host" and a list should appear.
123 The -I option may be useful if your netbios names don't match your
124 tcp/ip host names or if you are trying to reach a host on another
125 network. For example:
127 smbclient -L ftp -I ftp.microsoft.com
129 will list the shares available on microsofts public server.
135 This options allows you to send messages, using the "WinPopup"
136 protocol, to another computer. Once a connection is established you
137 then type your message, pressing ^D (control-D) to end.
139 If the receiving computer is running WinPopup the user will receive
140 the message and probably a beep. If they are not running WinPopup the
141 message will be lost, and no error message will occur.
143 The message is also automatically truncated if the message is over
144 1600 bytes, as this is the limit of the protocol.
146 One useful trick is to cat the message through smbclient. For example:
148 cat mymessage.txt | smbclient -M FRED
150 will send the message in the file "mymessage.txt" to the machine FRED.
152 You may also find the -U and -I options useful, as they allow you to
153 control the FROM and TO parts of the message.
155 Samba currently has no way of receiving WinPopup messages.
157 Note: Copy WinPopup into the startup group on your WfWg PCs if you
158 want them to always be able to receive messages.
164 This parameter, if specified, causes the client to write messages to the
165 standard error stream (stderr) rather than to the standard output stream.
167 By default, the client writes messages to standard output - typically the
176 represents the IP number of the server to connect to. It should
177 be specified in standard "a.b.c.d" notation.
179 Normally the client will attempt to locate the specified Lan Manager server
180 by looking it up - that is, broadcasting a request for the given server to
181 identify itself. Using this parameter will force the client to assume that
182 the server is on the machine with the specified IP number.
184 There is no default for this parameter. If not supplied, it will be determined
185 automatically by the client as described above.
191 If specified, this parameter suppresses the normal password prompt from the
192 client to the user. This is useful when accessing a service that does not
195 Unless a password is specified on the command line or this parameter is
196 specified, the client will request a password.
203 See the socket options section of smb.conf(5) for details
209 If specified, the service requested will be connected to as a printer service
210 rather than as a normal filespace service. Operations such as put and get
211 will not be applicable for such a connection.
213 By default, services will be connected to as NON-printer services.
221 is the user name that will be used by the client to make a connection,
222 assuming your server is running a protocol that allows for usernames.
224 Some servers are fussy about the case of this name, and some insist
225 that it must be a valid netbios name.
229 is supplied, it will default to an uppercase version of the
237 is supplied and neither environment variable exists the user name will
240 If the service you are connecting to requires a password, it can be supplied
243 option, by appending a percent symbol ("%") then the password to
245 For example, to attach to a service as user "fred" with password "secret", you
249 on the command line. Note that there are no spaces around the percent symbol.
251 If you specify the password as part of
255 option (suppress password prompt) is assumed.
257 If you specify the password as a parameter AND as part of
259 then the password as part of
261 will take precedence. Putting nothing before or nothing after the percent
262 symbol will cause an empty username or an empty password to be used,
265 Note: Some servers (including OS/2 and Windows for Workgroups) insist
266 on an uppercase password. Lowercase or mixed case passwords may be
267 rejected by these servers.
269 Be cautious about including passwords in scripts.
276 debuglevel is an integer from 0 to 5.
278 The default value if this parameter is not specified is zero.
280 The higher this value, the more detail will be logged to the log files about
281 the activities of the client. At level 0, only critical errors and serious
282 warnings will be logged. Level 1 is a reasonable level for day to day running
283 - it generates a small amount of information about operations carried out.
285 Levels above 1 will generate considerable amounts of log data, and should
286 only be used when investigating a problem. Levels above 3 are designed for
287 use only by developers and generate HUGE amounts of log data, most of which
288 is extremely cryptic.
297 specifies a base filename into which operational data from the running client
300 The default base name is specified at compile time.
302 The base name is used to generate actual log file names. For example, if the
303 name specified was "log", the following files would be used for log data:
306 log.client.debug (containing debugging information)
308 log.client.in (containing inbound transaction data)
310 log.client.out (containing outbound transaction data)
313 The log files generated are never removed by the client.
321 By default, the client will use the local machine's hostname (in
322 uppercase) as its netbios name. This parameter allows you to override
323 the host name and use whatever netbios name you wish.
330 port number is a positive integer value.
332 The default value if this parameter is not specified is 139.
334 This number is the port number that will be used when making connections to
335 the server. The standard (well-known) port number for the server is 139,
338 This parameter is not normally specified.
344 where tar options are one or more of c,x,I,X,b,g,N or a; used as:
347 .B "\\\\\\\\server\\\\share"
362 Create a tar file on UNIX. Must be followed by the name of a tar file,
363 tape device or "-" for standard output. (May be useful to set debugging
364 low (-d0)) to avoid corrupting your tar file if using "-"). Mutually
365 exclusive with the x flag.
368 Extract (restore) a local tar file back to a share. Unless the -D
369 option is given, the tar files will be restored from the top level of
370 the share. Must be followed by the name of the tar file, device or "-"
371 for standard input. Mutually exclusive with the c flag.
374 Include files and directories. Is the default behaviour when
376 are specified above. Causes tar files to be included in an extract or create
377 (and therefore everything else to be excluded). See example below.
378 Filename globbing does not work for included files for extractions (yet).
381 Exclude files and directories. Causes tar files to be excluded from
382 an extract or create. See example below.
383 Filename globbing does not work for excluded files (yet).
386 Blocksize. Must be followed by a valid (greater than zero) blocksize.
387 Causes tar file to be written out in blocksize*TBLOCK (usually 512 byte)
391 Incremental. Only back up files that have the archive bit set. Useful
392 only with the c flag.
395 Newer than. Must be followed by the name of a file whose date is
396 compared against files found on the share during a create. Only files
397 newer than the file specified are backed up to the tar file. Useful
398 only with the c flag.
401 Set archive bit. Causes the archive bit to be reset when a file is backed
402 up. Useful with the g (and c) flags.
407 smbclient \\\\mypc\\myshare "" -N -Tx backup.tar
409 Restore from tar file backup.tar into myshare on mypc (no password on share).
411 smbclient \\\\mypc\\myshare "" -N -TXx backup.tar users/docs
413 Restore everything except users/docs
415 smbclient \\\\mypc\\myshare "" -N -Tc backup.tar users/docs
417 Create a tar file of the files beneath users/docs.
426 Change to initial directory before starting. Probably only of any use
427 with the tar (\-T) option.
433 Once the client is running, the user is presented with a prompt, "smb: \\>".
434 The backslash ("\\") indicates the current working directory on the server,
435 and will change if the current working directory is changed.
437 The prompt indicates that the client is ready and waiting to carry out a user
438 command. Each command is a single word, optionally followed by parameters
439 specific to that command. Command and parameters are space-delimited unless
440 these notes specifically state otherwise. All commands are case-insensitive.
441 Parameters to commands may or may not be case sensitive, depending on the
444 You can specify file names which have spaces in them by quoting the
445 name with double quotes, for example "a long file name".
447 Parameters shown in square brackets (eg., "[parameter]") are optional. If not
448 given, the command will use suitable defaults. Parameters shown in angle
449 brackets (eg., "<parameter>") are required.
451 Note that all commands operating on the server are actually performed by
452 issuing a request to the server. Thus the behaviour may vary from server to
453 server, depending on how the server was implemented.
455 The commands available are given here in alphabetical order.
470 command will display a brief informative message about the specified command.
472 If no command is specified, a list of available commands will be displayed.
489 command will execute a shell locally and run the specified shell command. If
490 no command is specified, a shell will be run.
505 is specified, the current working directory
507 will be changed to the directory specified. This operation will fail if for
508 any reason the specified directory is inaccessible.
510 If no directory name is specified, the current working directory
525 The client will request that the server attempt to delete all files matching
527 from the current working directory
541 A list of the files matching
543 in the current working directory
545 will be retrieved from the server and displayed.
558 Terminate the connection with the server and exit from the program.
566 .I <remote file name> [local file name]
573 from the server to the machine running the client. If specified, name the
576 Note that all transfers in smbclient are binary. See also the
608 is specified, the current working directory
609 .B on the local machine
610 will be changed to the directory specified. This operation will fail if for
611 any reason the specified directory is inaccessible.
613 If no directory name is specified, the name of the current working directory
614 .B on the local machine
628 Toggle lowercasing of filenames for the
634 When lowercasing is toggled ON, local filenames are converted to lowercase
639 commands. This is often useful when copying (say) MSDOS files from a server,
640 because lowercase filenames are the norm on Unix systems.
668 This command allows the user to set up a mask which will be used during
669 recursive operation of the
675 The masks specified to the
679 commands act as filters for directories
680 rather than files when recursion is toggled ON.
682 The mask specified with the
684 command is necessary to filter files within those directories. For example,
685 if the mask specified in an
689 the mask specified with the
693 recursion is toggled ON, the
695 command will retrieve all files matching "*.c" in all directories below
696 and including all directories matching "source*" in the current working
699 Note that the value for
701 defaults to blank (equivalent to "*") and remains so until the
703 command is used to change it. It retains the most recently specified value
704 indefinitely. To avoid unexpected results it would be wise to change the
707 back to "*" after using the
739 Copy all files matching
741 from the server to the machine running the client.
745 is interpreted differently during recursive operation and non-recursive
746 operation - refer to the
750 commands for more information. Note that all transfers in smbclient are
766 Create a new directory
768 (user access privileges permitting) with the specified name.
781 Copy all files matching
783 in the current working directory
784 .B on the local machine
785 to the current working directory on the server.
789 is interpreted differently during recursive operation and non-recursive
790 operation - refer to the
794 commands for more information. Note that all transfers in smbclient are
808 Print the specified file
809 .B from the local machine
810 through a printable service on the server.
822 .I <graphics or text>
827 Set the print mode to suit either binary data (such as graphical information)
830 commands will use the currently set print mode.
843 Toggle prompting for filenames during operation of the
849 When toggled ON, the user will be prompted to confirm the transfer of each
850 file during these commands. When toggled OFF, all specified files will be
851 transferred without prompting.
859 .I <local file name> [remote file name]
866 from the machine running the client to the server. If specified, name the
869 Note that all transfers in smbclient are binary. See also the
884 Displays the print queue, showing the job id, name, size and current status.
927 Toggle directory recursion for the commands
933 When toggled ON, these commands will process all directories in the source
934 directory (ie., the directory they are copying
936 ) and will recurse into any that match the mask specified to the command. Only
937 files that match the mask specified using the
939 command will be retrieved. See also the
943 When recursion is toggled OFF, only files from the current working
944 directory on the source machine that match the mask specified to the
948 commands will be copied, and any mask specified using the
950 command will be ignored.
963 Remove all files matching
965 from the current working directory
979 Remove the specified directory (user access privileges permitting)
993 Performs a tar operation - see -T command line option above. Behaviour
994 may be affected by the
996 command (see below). Using the g (incremental) and N (newer) will affect
997 tarmode settings. Note that using the "-" option with tar x may not
998 work - use the command line option instead.
1011 Blocksize. Must be followed by a valid (greater than zero) blocksize.
1012 Causes tar file to be written out in blocksize*TBLOCK (usually 512 byte)
1021 .I <full|inc|reset|noreset>
1026 Changes tar's behaviour with regard to archive bits. In full mode,
1027 tar will back up everything regardless of the archive bit setting (this
1028 is the default mode). In incremental mode, tar will only back up files
1029 with the archive bit set. In reset mode, tar will reset the archive bit
1030 on all files it backs up (implies read/write share).
1038 .I <filename> <perm=[+|-]rsha>
1043 A version of the DOS attrib command to set file permissions. For example,
1047 would make myfile read only.
1052 Some servers are fussy about the case of supplied usernames, passwords, share
1053 names (aka service names) and machine names. If you fail to connect try
1054 giving all parameters in uppercase.
1056 It is often necessary to use the
1058 option when connecting to some types
1059 of servers. For example OS/2 LanManager insists on a valid netbios name
1060 being used, so you need to supply a valid name that would be known to
1064 supports long file names where the server supports the LANMAN2
1070 .SH ENVIRONMENT VARIABLES
1073 The variable USER may contain the username of the person using the client.
1074 This information is used only if the protocol level is high enough to support
1075 session-level passwords.
1079 The location of the client program is a matter for individual system
1080 administrators. The following are thus suggestions only.
1082 It is recommended that the client software be installed under the /usr/local
1083 hierarchy, in a directory readable by all, writeable only by root. The client
1084 program itself should be executable by all. The client should NOT be setuid
1087 The client log files should be put in a directory readable and writable only
1090 To test the client, you will need to know the name of a running Lan manager
1091 server. It is possible to run the smbd (see
1092 .B smbd(8)) as an ordinary user - running that server as a daemon on a
1093 user-accessible port (typically any port number over 1024) would
1094 provide a suitable test server.
1096 This man page is (mostly) correct for version 1.9.00 of the Samba suite, plus some
1097 of the recent patches to it. These notes will necessarily lag behind
1098 development of the client software, so it is possible that your version of
1099 the client has extensions or parameter semantics that differ from or are not
1100 covered by this man page. Please notify these to the address below for
1106 [This section under construction]
1108 Most diagnostics issued by the client are logged in a specified log file. The
1109 log file name is specified at compile time, but may be overridden on the
1112 The number and nature of diagnostics available depends on the debug level used
1113 by the client. If you have problems, set the debug level to 3 and peruse the
1116 Most messages are reasonably self-explanatory. Unfortunately, at time of
1117 creation of this man page the source code is still too fluid to warrant
1118 describing each and every diagnostic. At this stage your best bet is still
1119 to grep the source code and inspect the conditions that gave rise to the
1120 diagnostics you are seeing.
1125 The original Samba software and related utilities were created by
1126 Andrew Tridgell (samba-bugs@anu.edu.au). Andrew is also the Keeper
1127 of the Source for this project.
1129 This man page written by Karl Auer (Karl.Auer@anu.edu.au)
1132 .B smb.conf(5) for a full list of contributors and details on how to
1133 submit bug reports, comments etc.