How to access Windows Shares under Linux

This is simple way to share data between Windows and Linux system. Let’s say you would like to access Windows share called //winserver/sharename by mounting to /mnt/windows directory under Linux system. Follow these steps (replace username, windows server name, share name and password with actual values):

First create the mount point:

mkdir -p /mnt/windows

Now mount it with following command:

mount -t smbfs -o username=user,password=Password //winserver/sharename /mnt/windows

To have the share mounted automatically at every system start (after reboot), edit the file system table.

vi /etc/fstab

Append following line (written in a single line):

//winserver/sharename /mnt/windows smbfs auto,gid=users,fmask=0664,dmask=0775,iocharset=iso8859-15, credentials=/etc/sambapasswords 0 0

Next create the password file /etc/sambapasswords:

vi /etc/sambapasswords

Now add following content:

username = windows_username
password = windows_password

Save and close the file. Make sure only root can access this file:

chown 0.0 /etc/sambapasswords
chmod 600 /etc/sambapasswords