Network Administration: Samba Client

Samba includes a program called smbclient that lets you access Windows file servers from a Linux computer. The smbclient program works much like an FTP client, so if you’ve used FTP before, you’ll have no trouble understanding how it works.

Smbclient is a command line tool, so you need to log on to a virtual console or open a terminal window. Then, enter the smbclient command, followed by the server and share name, like this:

smbclient //server01/share01

When the client successfully accesses the share, you are greeted by the friendly SMB prompt:

smb:>

Then, you can enter smbclient commands to access the data in the shared directory. The following table summarizes the more common commands that are available at the smb:> prompt.

Commonly Used smbclient Commands
Command Description
cd directory Changes to the specified directory on the remote system.
del filename Deletes the specified file or files on the remote system.
dir Lists files in the current directory on the remote system.
exit Terminates the session.
get remote-file local-file Copies the specified remote file to the specified local
file.
lcd directory Changes the local current directory to the specified
directory.
md directory Creates a directory on the remote system.
mget wildcard-mask Copies all files that match the wildcard mask from the remote
system to the local system.
mput wildcard-mask Copies all files that match the wildcard mask from the local
system to the remote system.
put local-file remote-file Copies the specified file from the local system to the remote
system.
rd directory Deletes the specified directory on the remote system.