Question:
Automount a CIFS share on Linux Mint?
anonymous
2013-12-03 11:01:31 UTC
I have a script that automounts two CIFS shares on a local NAS. However, I have to run the script manually whenever my computer connects to the internet. How do I have it set to a 5-10 minute delay (to allow network activation), and then have it connect to the drive (all at boot)? I run Linux Mint, and have to run the script as root.
Three answers:
Chris D
2013-12-04 02:34:48 UTC
The automounter can be a useful option in this kind of situation ("autofs4").



It allows you to define a directory tree on your system and a set of target hosts and filesystems. Then, when you try to access the nominated filesystems they get mounted automatically at the point you use them, and dismounted after a definable period of idle time.



It's not as simple as the other solutions suggested here in other Answers, but it's certainly something a competent Linux-based system user should consider.



Here's an example of what I've done at home - create a static directory tree /net/shared that points into the tree dynamically managed by autofs:



$ ls -l /net/shared

lrwxrwxrwx 1 root root 55 May 27 2013 /net/shared -> /var/autofs/net/buzzard/home/remote/shared
Lesus
2013-12-03 19:11:18 UTC
To make a script run at boot, you could name it /etc/rc.local , or if there is an /etc/rc.local script, modify it to call your script. You can use the command "sleep 600" for a 10 minute delay.
Krowten Nimda
2013-12-03 22:33:34 UTC
Why not just edit fstab. When you login in it will use your credentials (or other credentials if needed) to connect if a network connection is present.



http://community.linuxmint.com/tutorial/view/77


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...