First I added a symbolic link to /etc/init.d/rc5.d/:
cd /etc/init.d/rc5.d sudo ln -s ../autofs S21autofs
Then I added to the /etc/auto.master the following line:
/media/automounts /etc/auto.smbmounts
Then 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.fi
Then I activated the autofs daemon:
sudo /etc/init.d/autofs start
Now 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.