Command Line – Sending Files Over Samba

command linefile-transfersambascp

I was wondering if there is a way to use Samba to send items to a client machine via the command line (I need to send the files from the Samba server). I know I could always use scp but first I was wondering if there is a way to do it with Samba. Thanks!

Best Answer

Use smbclient, a program that comes with Samba:

$ smbclient //server/share -c 'cd c:/remote/path ; put local-file'

There are many flags, such as -U to allow the remote user name to be different from the local one.

On systems that split Samba into multiple binary packages, you may have the Samba servers installed yet still be missing smbclient. In such a case, check your package repository for a package named smbclient, samba-client, or similar.

Related Question