
Samba Distribution Programs
|
89
smbclient
smbclient //server/share [password] [options]
The smbclient program is the “Swiss army knife” of the Samba
suite. Initially developed as a testing tool, it has become a
command shell capable of acting as a general-purpose Unix client,
with a command set very similar to that of ftp. It offers the
following set of functions:
• Interactive file transfer, similar to ftp
• Interactive printing to shared SMB printers
• Interactive tar format archiving
• Sending messages on the SMB network
• Batch mode tar format archiving
• “What services do you have?” querying
• Debugging
It is possible to run smbclient noninteractively, for use in scripts,
by specifying the
-c option along with a list of commands to
execute. Otherwise, smbclient runs in interactive mode,
prompting for commands such as this:
smb:\>
The backslash in the prompt is replaced by the current directory
within the share as you change your working directory with
smbclient’s cd command.
Options
-A authfile
Specifies a file from which to read the username and pass-
word used for the connection. The format of the file is as
follows:
username = value
password = value
domain = value
This is to avoid having the password prompted for or have it
appear in plain text in scripts. The permissions on the file
should be very restrictive (0600, for example) to prevent
access by unwanted users.