smbclient alternative for large files

Try using these socket options on smbclient

smbclient --socket-options='TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=131072 SO_SNDBUF=131072'

I regularly copy 40+GB files from Windows to Linux media server without error, typical transfer rate is 85MB/s with machines connected via gigabit switch.


Using curl

I'm running smbclient version 4.9.4 trying to transfer a 97 MiB file from Arch Linux to Windows and calling smbclient with --socket-options='TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=131072 SO_SNDBUF=131072' as user bsd recommended still failed with cli_push returned NT_STATUS_IO_TIMEOUT.

Since version 7.40, curl supports the smb protocol.

Thus, I used this to upload the moderately_sized_file from Linux to the service OurRemoteDirectory on the Windows machine at 172.16.17.52:

curl --upload-file /home/me/moderately_sized_file --user "OurWindowsDomain/MyUserName:MyPassword" smb://172.16.17.52/OurRemoteDirectory/Path/To/Dir/

For me, curl has uploaded the file reliably each time and also displays upload progress, which is nice.

Note that curl doesn't yet support creating directories on the remote host.

Consequently, you might need to create /Path/To/Dir/ using the following command (but smbclient mkdir has worked without an issue so far):

smbclient //172.16.17.52/OurRemoteDirectory/ -U MyUserName%MyPassword -W OurWindowsDomain -c 'mkdir Path/To/Dir/'