smbclient, a command-line client for accessing SMB/CIFS servers, is a great tool for shunting large quantities of data between servers on a local network. Unfortunately, the man page for smbclient is a bit of a chore – it doesn’t offer any useful examples, making it unnecessarily difficult for the first-time user to make any progress with the software.

To copy from one server to another, SSH into the destination box then make a connection with the following command:

smbclient //your_ip_address/name_of_share -U your_username


Upon connecting:

smb: \> recurse
smb: \> prompt
smb: \> mget *

The recurse command toggles directory recursion; prompt toggles confirmation prompts (you’ll want this off if you’re copying thousands of files!). The mget command will now copy recursively from the the target smb resource to the current directory of the destination machine. To change directory, simply CD as per usual; for a list of available commands type help.

Related Posts