Sending files over Samba with command line

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.


curl supports the smb protocol since v7.40: curl --upload-file /path/to/file.ext -u 'DOMAIN\Username' smb://172.16.17.52/ShareName/


Really working will be this:

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

local-file - file from local machine

remote-file - copy to this file on remote machine