Using the Samba Client on the Command Line

The smbclient command is useful for both accessing files on a remote Microsoft Network or Samba server, and for testing the Samba services on your own server.

To connect to your server’s own Samba services from the command line as a test, enter the following command, where share is the name of the share you want to connect to (either a user’s login name or the word "root") and username is the username to log in as:

> smbclient "\\localhost\share" -U username

Once connected, you’ll be asked for the password associated with the username you provided, and after logging in, you will be presented with a prompt that looks like the following:

smb:

To list the files in the current directory of the share, type:

> ls

For additional information on using the smbclient command and the commands that can be given from the Samba command prompt, consult the smbclient man page.