Automount a network drive

From AwkwardTV
Jump to: navigation, search

First, thanks to Azral !

The solution is to create a startupitem in /Library/StartupItems/. the first example is for those with sharity light installed already, and there's an alternative at the bottom for afp_mount.

First off, create a catalog (in this case named "MountStuff" but a name of your choosing should suffice - rename files/parameters if you change name), with a command like

sudo mkdir /Library/StartupItems/MountStuff

inside it, make two files:

File MountStuff containing:

/usr/sbin/shlight '//Storage/DISK 2' /Users/frontrow/Movies/disk -U pcguest -P pcguest 

File StartupParameters.plist containing:

  Description = "MountStuff";
  Provides = ("Mounts");
  Requires = ("Network");
  OrderPreference = "None";

Don't forget to clean up permissions/ownership with something like:

sudo chmod +x /Library/StartupItems/MountStuff
chown -R root:wheel /Library/StartupItmes/MountStuff

And thats about it! Now it mounts my share(s) on startup. (:

alternatively, if you have installed the mount_afp hack, make the MountStuff file contain something of this format:

mount_afp "afp://;AUTH=No%20User%20Authent@servername/share" ~/mountpoint/  # for guest log ins
mount_afp afp://username:password@servername/ ~/mountpoint/    #for password access