autofs, automount, auto.master and mounting samba shares
Last modified on July 24, 2026 • 1 min read • 73 wordsFirst I added a symbolic link to /etc/init.d/rc5.d/:cd /etc/init.d/rc5.d sudo ln -s ../autofs S21autofsThen I added to the /etc/auto.master the following line:/media/automounts /etc/auto.smbmountsThen I created the file auto.smbmounts with the following content:michael_msbl.helsinki.fi -fstype=smbfs,username=michael,password= ://paula/michael Then I created the mountpoint:sudo mkdir /media/automounts/michael_msbl.helsinki.fiThen I activated the autofs daemon:sudo /etc/init.d/autofs startNow whenever one tries to access the directory /media/automounts/michael_msbl.helsinki.fi, the autofs daemon will mount the smb share automatically and unmount after a certain period of inactivity.
cd /etc/init.d/rc5.d sudo ln -s ../autofs S21autofsThen I added to the /etc/auto.master the following line:/media/automounts /etc/auto.smbmountsThen I created the file auto.smbmounts with the following content:michael_msbl.helsinki.fi -fstype=smbfs,username=michael,password=## ://paula/michael Then I created the mountpoint:sudo mkdir /media/automounts/michael_msbl.helsinki.fiThen I activated the autofs daemon:sudo /etc/init.d/autofs startNow whenever one tries to access the directory /media/automounts/michael_msbl.helsinki.fi, the autofs daemon will mount the smb share automatically and unmount after a certain period of inactivity.