Saturday, October 4, 2008

Using SMBCLIENT to transfer files.

This information is gathered from a few different sources. I have it here for reference:

Step 1:
Create a file that contains authentication details. In my test case I had no domain to bother with so just added the username and password fields.

I also made a point of ensuring that the file permissions for this file were set to the owner having access only. Ie: rw- --- --- or ( 600 )

Thanks to: http://www.javascriptkit.com/script/script2/chmodcal.shtml for the very useful chmod calculator.

smbclient_authentication.txt
username = backupuser
password = Pa$$w0rd

Step 2:
In your script or whatever the way to put a file onto the windows share is like this:

~> smbclient -A smbclient_authentication.txt ////192.168.0.96//data -c "put myBackupFile.tar.gz"
That's about it. Piece of cake. When I test this on an SELINUX environment, I am sure this tutorial will be extended somewhat!
Post a Comment