Saturday, April 11, 2020

Using Linux autofs To Automatically Mount CIFS Shares

AutoFS can be configured to automatically mount shares on directory access.
To do this we will create a config file for the mount, and direct autofs to use this file.

In auto.servername we define how to mount the share .
$ cat /etc/auto.servername
sharename -fstype=cifs,rw,uid=1000,gid=1000,password=Password1 ://servername/sharename

We define the mount location and the auto.servername file to use, appending to the existing /etc/auto.master file.
/mnt/servername /etc/auto.servername

After these are defined, we can reload autofs
sudo systemctl reload autofs

No comments:

Post a Comment