Mount Windows Share in Linux

On Ubuntu, install cifs-utils

apt-get install cifs-utils

First create a directory on which we can mount the windows share

mkdir /media/SHARE_NAME

Now create a file to store windows share username and password.

vi /etc/SHARE_NAME.smbcredentials

Add following to the file

username=YOUR_WINDOWS_SHARE_USER
password=YOUR_WINDOWS_SHARE_PASSWORD

Now run

mount -t cifs //192.168.0.4/SHARE_NAME /media/SHARE_NAME -o credentials=/etc/SHARE_NAME.smbcredentials,uid=LINUX_USER_NAME,iocharset=utf8,sec=ntlm,rw,dir_mode=0777,file_mode=0666

192.168.0.4 – Replace with IP of your Windows computer with share.

LINUX_USER_NAME – Replace with the Linux user name you want the files to be owned.

To make share mounted on boot, edit

vi /etc/fstab

Add

//192.168.0.4/SHARE_NAME  /media/SHARE_NAME  cifs  credentials=/etc/SHARE_NAME.smbcredentials,uid=LINUX_USER_NAME,gid=GID_OF_LINUX_USER,_netdev,iocharset=utf8,dir_mode=0777,file_mode=0666  0  0

mount

Comments

Leave a Reply

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