Copy file from Windows shared folder to Unix

With smbclient installed on the *nix machine, you don't need to mount the Windows share at all. For example, to retrieve C:\Directory\file.txt and copy it to /tmp on your Linux computer do this:

smbclient '//windowsserver/c$' -c 'lcd /tmp; cd Directory; get file.txt' -U administrator%password

See https://superuser.com/a/562728/48742 for details. This was discussed over there.


From your UNIX server you need to mount the Windows share using the procedure laid out in this link.

Basically you create a directory on your UNIX machine that is called the mount point. You then use the mount command to mount the Windows share on that mount point. Then when you go to the directory that you have created you see the files that are in the Windows share.


If you can see \Servername.com\testfolder in Windows machine, then you can use your own username and password.

On a linux machine, you can use

sudo mount -t cifs -o username=YourWindowsLogin,password=YourWindowsPassword //Servername.com/testfolder /mnt/testfolder

/mnt/testfolder must exist beforehand.

Then you can copy file from /mnt/testfolder.

Use sudo umount /mnt/testfolder to unmount the folder.