I have automounts via SMB (as this is the fastest option) working very well from a Synology NAS.
Here's the main point: Change in the file /etc/autofs.conf the
AUTOMOUNT_TIMEOUT=3600000
This is 1000 hours. Reboot to take effect.
The rest of the config is similar to what other people have posted. In my case like this:
auto_master: add to the end
/Volumes/Media auto_exec
then you create an root owned, wheel executable script
ls -al /etc/auto_exec
-rwxr-xr-x 1 root wheel 2005 27 Okt. 13:04 auto_exec
with this content:
#!/bin/bash
# By www.stefan-ried.de 11/2016 .. 10/2025
# Open Source
#
# Name or IP of your NAS
server="Media" # replace with the local name of your NAS server
# List of share you want to mount
shares="GemeinsameDateien photo homes Stef web" # add the Name of shared folder you like to automount
# NAS use name
user="<your NAS user>"
# NAS PW
userpw="<your NAS password>"
# local logfile
logfile="/dev/null" # replace /dev/null with a log file of your choice
#
# automountd calls this without an argument to show the folders
# or with a specific folder name as argument to retrieve the mount parameter for it
#
# Make sure this file is in /etc and executable (chmod +a), call it auto_exec
# Add to /etc/auto_master for example this line, you might need to do this after a MacOS upgrade again
# /Volumes/Media auto_exec
#
# automount will then execute this file when the folder is accessed
# Reload the changes to your auto_master and auto_exec with automount -vc
# use tail -f <you log file> to see whats going on, when you ls into /Volume/..
#
# If you like to have the automounts permanently Change in the file /etc/autofs.conf the
# AUTOMOUNT_TIMEOUT=3600000
#
# In the right network?
# replace the 10.0.0.0 with your networkspace where your NAS is.
#
if ifconfig | grep "10.0.0." > /dev/null; then
echo "In home network" >> $logfile
else
echo "Outside home network - not mounting anything" >> $logfile
exit
fi
#
# Server reachable?
#
if ping -c 1 -Q -W 100 $server &> /dev/null; then
echo "Server Online" >> $logfile
else
echo "Server Offline" >> $logfile
exit
fi
if [ $# = 0 ]; then # List keys
echo `date` "Showing Folders/Keys" $1 >> $logfile
for mountpoint in $shares; do
echo -e "$mountpoint" >> $logfile
echo -e "$mountpoint"
done
else
echo `date` "Requesting Mountpoint" $1 >> $logfile
for mountpoint in $shares; do
if [ $1 = $mountpoint ]; then
echo -e "smb://$user:$userpw@Media/$mountpoint"
echo -e "smb://$user:$userpw@Media/$mountpoint" >> $logfile
# uncomment this, if you want AFP, but SMB is the fastest with Synology
# echo -e "afp://$user:$userpw@Media/$mountpoint"
# uncomment this, if you want NFS
# echo -e "-fstype=nfs,resvport,vers=4.1 $server:/volume4/$mountpoint"
fi
done
fi
The approach ignores the automatically scanned server mounts under /Network in the finder and creates an new one under /Volumens/<servername>, just drop this as a favorite into finder. Open tabs remain (SMB) mounted for ever.
In detail, the script provides to the automounter the folder and corresponding mount commands dynamically.
If you call it form the terminal, you see folders. If you add one folder name as arguments, you see individual mount points. This is how unix automounter works since 25+ years :)
When this works, you can reload the automounter with the command: automount -vc
One little add-on: My Macbook should only tell anything to the automounter if it is in the home network (10.0.0.x in my case) and can ping the NAS. This trick avoids any hanging of the finder if you are in public networks on the road.
The script is on my Mac for nearly 10 years and still works on Tahoe.
The AUTOMOUNT_TIMEOUT=3600000 works best with SMB.
No paid tool is needed.
Have fun.