Autofs lets you mount a network drive/folder automatically without fiddling with fstab.
Firts add a file to the root home folder with the credentials to access that network folder. We named our file credentials.txt, than add:
username="the username"
password="the password"
Next add to the folder etc/auto.master.d a file with the following code
share1 -fstype=cifs,rw,noperm,credentials=/root/credentials.txt ://path to the source folder
We named this file as share1
Add another file to the same folder but with an extension .autofs and add the following code
/path to the destination folder /etc/auto.master.d/share1 --timeout=60 --ghost
We named this file as share1.autofs
Now we need to enable autofs to run at boot time
On a terminal type (you need elevated privileges)
systemctl enable autofs.service
Now reboot or type on a terminal
systemctl start autofs.service
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment