"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects." (Robert A. Heinlein)

Wednesday, 13 January 2010

Mounting a permanent Samba share

I recently bought a network disks in order to use it as external storage for all my computers. I so immediately felt the need of an easier way to access to Samba shared folders. This is even more evident in my desktop computer where Xubuntu standard file manager (Thunar) doesn't even support Samba shared folders.

Mount a samba share in fstab

I decided to permanently mount the network disk shares configuration file, I followed this how-to from Ubuntu wiki with only a few changes.
I first installed smbfs file system
sudo apt-get install smbfs

then I prepared a credentials file in my home directory
sudo gedit .smbcredentials
inside I did write the network disk authentication user and password (different from my Linux user and password)
I so changed access permissions to credentials file so that only root user could read it
sudo chmod 600 .smbcredentials
then I created the mount-point folder and let everyone access to it
sudo mkdir /media/nas
sudo chmod 777 /media/nas
then I edited the fstab file
sudo gedit /etc/fstab
and added the following line (all in one line)
// /media/nas cifs credentials=/home/maxx/.smbcredentials,dir_mode=0777,file_mode=0777,umask=000,uid=maxx 0 0
where is the (fixed) network drive address and sh_maxx is the samba share name.
At last I only had to execute the following command
sudo mount -a

I repeated these actions on all my three computers, at last I managed to have the networked folder content as easily available as to access to any other folder in the file system. All this only at the price some text file editing . Of course the network disk must be turned on before any computer but, if I forget to, it's only matter of executing the mount -a command.