Mounting Windows Share to Linux

In order to Mount a windows share to Linux , create a share in your windows


Now in the linux server create a directory where you want to mount the share
mkdir /mnt/winshare

Now mount the share by typing the following command:
mount -t cifs -o username=,password= //serverip/shareddrive /mnt/winshare

If you want the drive to be mounted on reboots, create an fstab entry:

vi /etc/fstab
//serverip/shareddrive /mnt/winshare cifs auto,gid=users,file_mode=0664,dir_mode=0775,iocharset=iso8859-15,credentials=/etc/sharepasswd 0 0

Now create a password file /etc/sharepasswd
vi /etc/sharepasswd

mount -a

Now you can access your windows share at /mnt/winshare

6 thoughts on “Mounting Windows Share to Linux

  1. Hello Amit,

    I used your process to mount one of the windows server on my Linux server. That works perfect. Thanks.

    I am having some issues like when I export any text file directly to Linux directory and shared it from my desktop to other then same file is getting loaded into other database successfully but when I generate the file into the mounter server then while loaded into the database it’s getting error for file terminator is not correct.
    But everything works fine when I share them manually

  2. Mounter server means the Linux server where you have mounted the windows share ? So as far as I understand your question, if you create file from windows it works fine but if you create file from Linux ( the server that mounts the share ) you are having error ?

    If that is the case, then it could be permission/ownership issue. When you create the file in Linux machine the owner could be the user creating file.. but really need to know more to pinpoint the issue.

    Thanks and I am glad that helped you.

  3. No I am generating the file from Linux only, but when exported to Linux drive and copy to my desktop then it works fine but if I export the file on Mounter server then it don’t.


Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.