Making samba permanent and auto-mount in linux

How to make Permanent mount of samba share in Linux and make it an auto mount as well
Hi Guys, This is something very rare you can find on any portal, I hope you will certainly learn something new today.so enjoy learning!!!! Keep coming back for more.
Sometimes we need to make the samba mount as permanent in Linux, as we can make an nfs mount permanent.
 
Scenario: As samba mostly created on user authentication. so, here I use share-name as unixmate and user as unixmate as well, the password I’ve given is red.
 
My server address is 192.168.104.92, on client I’m using directory to mount with the name /smbc.
 
As to mount samba share we need to provide user credentials, but in this scenario we want it to be taken automatically. There are two ways of giving credentials, either keep username and password in a file and give information about it in /etc/fstab, or directly give username and password in fstab itself.
Let’s see the first one, where I’ve created a file called /pass and kept the credentials as follows:
In order to make a permanent mount of a samba share we need to make the entry in /etc/fstab as following.
In place of credentials, you can directly give username=unixmate,password=red
 


Use mount -a and verify whether it mounted automatically or not.


Done!!!!!.
 
MAKING AUTO MOUNT WITH SAMBA
 
In order to work with auto mount, remove all the previous entries from /etc/fstab.
Once done, follow the steps below.
 
Just like nfs automount, you need to edit /etc/auto.master, the master configuration file.

Now, Create /etc/auto.samba as following
 
Restart autofs daemon
#service autofs restart
 
Navigate to /smb and mount will be happen automatic, once left after 10 sec mounting will be disconnected.
 
ENJOY LEARNING!!!! KEEP COMING BACK FOR MORE.


  1. Kiran Kumar

    April 5, 2016 at 9:19 am

    This comment has been removed by the author.

Comments are closed.