O'Reilly logo

Using Samba, Second Edition by David Collier-Brown, Robert Eckstein, Jay Ts

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

smbclient

Synopsis

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

Command synopsis

smbclient //server/share 
                  [ password] [options]

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 password 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.

-b buffer_size

Sets the size of the buffer used when transferring files. It defaults to 65520 bytes and can be changed as a tuning measure. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required