I am totally new to Unix. I am writting a script which will copy files from a Windows shared folder to Unix.

In Windows, when I type \\Servername.com\testfolder in Run command I am able to see testfolder. The directory testfolder is a shared folder through the whole network.

Now I want to copy some files from that testfolder to a Unix machine. Which command should I use? I know the IP Address of server but I don't know the username.

3 Answers 3


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.

  • 2
    If guest access enable, i use -U guest%
    – Andrey
    Commented Aug 7, 2017 at 7:46

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .