[olug] samba to windows share using UNC?

Ryan Stille ryan at cfwebtools.com
Fri Jun 20 00:14:54 UTC 2008


>>> Is it possible to copy a file to a windows share, without mounting it as
>>> a local file system first?  I've used smbmount in the past, then copied
>>> the file, but in this case I just want to copy it using a UNC path,
>>> specifying the username/password on the command line.
>>>
>>> -Ryan
>>>
>>
>> Without mounting try ...
>>
>> smbclient //server/share -U user%pass -c 'put file'
>>
>> where "file" is in your local machine's cwd.
>>
>>
>
> Awesome, that worked.  But my goal was to not take up space on the local
> machine.   I'm creating a 4GB file, and I'd rather place it directly on
> the remote machine, rather than create it locally and then copy it.
> Anyway to do that?

Same command with a twist :)

./program | smbclient //server/share -U user%pass -c 'put - rfile'

stdout of "program" piped to smbclient;
  put stdin to remote file "rfile"

Sweet!  Thanks Ted.  I looked in the man page but must have missed that.





More information about the OLUG mailing list