Saturday, August 16, 2014

Automatically mount windows share on ubuntu linux

Create a file that will hold the user and password for the share. Make this file readable only by you.
nano ~/.raspcredentials

(type the following)

chmod 600 ~/.raspcredentials

Create the mount point for the share. I'll call it ~/docs but can be what you want
mkdir ~/docs

edit fstab as root. Here we will mount the /home of the share to the ~/docs folder.
Add this line to fstab

//ip_address_or_hostname/home /home/your_username/docs cifs credentials=/home/your_username/.raspcredentials,iocharset=utf8,sec=ntlm,uid=your_username,user,users 0 0

// /home/tiago/docs cifs credentials=/home/tiago/.raspcredentials,iocharset=utf8,sec=ntlm,uid=tiago,user,users 0 0

At this moment you cannot yet mount it because samba/cifs is not yet installed. This is easy to fix:
sudo apt-get install cifs-utils
As non root, to be able to mount use mount <mount_point>. In this case this is
mount ~/docs


No comments:

Post a Comment