Automount shared directory on Leopard
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 /etc/auto_master :
sudo nano /etc/auto_masterThe 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
/- -staticYou need to add a line like this, just before /- -static. :
/my/mount/point/path auto.smbWhere /my/mount/point/path will be the full path to the directory where remote shared folders will appears. Mine is set to /Users/_myusername_/Desktop/Shares.
Now create a new file in /etc/auto.smb :
sudo nano /etc/auto.smbAnd 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_namewww : 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 username and 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.smbNow restart automount daemon :
automount -vcYou 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 unmountsNotice 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.
2 comments »
-
By freespace 23 days later:
-
By Jean Rajotte over 1 year later:
Late in the day, but here goes.
I’m new @ Leopard. Our imac is used by several users. The shared storage is a NAS device providing Samba or FTP protocols only. When I follow the recipe above, I find the access rights to the now visible shared folders are all 700 (IOW, only root can access them, although all users see them at the mount points. That’s the last piece of that puzzle. Thanks for getting me in the ballpark. Any suggestion as to the next step?Jean
Thank for this hint. I needed to play in /home and needed /home to be unmounted.
Cheers,
Steve