Following my last post, here’s another handy new thing to do in Leopard. I never used this in Tiger (MacOS X.4) because it was not practical (besides being possible), but I swear it was usable by the time.
Auto-mounting remote shared server (Samba, NFS, AFS) wherever I want, without being stuck with a dead Finder.app whenever I lost wifi network, I change room or my mac goes to sleep (yep I used to have some problems with this).
So now how to do this ? NetInfo is gone so where can I define my automount points, remember when I said NetInfo is dead for the best ?
First, you should edit
sudo nano /etc/auto_master
The stock version should looks like this :
# # Automounter master map # +auto_master # Use directory service /net -hosts -nobrowse,nosuid /home auto_home -nobrowse /Network/Servers -fstab /- -static
You need to add a line like this, just before
/- -static. :
/my/mount/point/path will be the full path to the directory where remote shared folders will appears. Mine is set to
Now create a new file in
sudo nano /etc/auto.smb
And add one line per remote folder you want to mount automatically, each line should looks like this :
www -fstype=smbfs ://username:password@remote_server_name_or_ip/shared_folder_name
www : this is the name you want to give to the remote folder locally
-fstype=smbfs : specify the kind of filesystem to use, I only cover samba here.
://username:passwordremote_server_name_or_ip/shared_folder_name@ : this is the informations to connect to the remote server. Change
password with yours, specify
remote_server_name_or_ip to reflect the way you access the machine and set
shared_folder_name to the name of the remote folder.
Then set permission on the new file :
sudo chmod 600 /etc/auto.smb
Now restart automount daemon :
You should see your new mount point as well as stock ones :
automount: /net updated automount: /home updated automount: /my/mount/point/path updated automount: no unmounts
Notice just like /etc/hosts that Leopard seems to only detect a change if a line is added/removed, so anytime you make a change that does not change the line number in the file add a comment (
#) at the beginning or end to force a reload.
Sat, 26 Jan 2008 22:28 Posted in Apple