Interacting with a Windows Share from Linux

Problem: I needed to transfer files between a Linux filesystem and a Windows file share.

Solution: Using mount and smbclient got things working.

smbclient //host/share$ -U domain/user%password --max-protocol=SMB2_24 -c 'get backup\backup.txt backup/backup.txt'
smbclient //host/share$ -U domain/user%password --max-protocol=SMB2_24 -c 'put backup/backup.txt backup\backup.txt'
mount -t cifs //host/share$ /mnt/share -o username=user,domain=domain,vers=2.1
# with environment variables
smbclient //host/share$ "$PASSWORD" -U domain/user --max-protocol=SMB2_24 -c 'get '$PATH'\backup.txt backup/backup.txt'

Note: smbclient was preferred since the container hosting service did not allow containers to mount to the filesystem.


One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.