Monday, 15 February 2010

OS X auto-mounting shares

Well, as part of my xgrid project, I wanted the machines to mount a networked share before login so that the xgrid app could save the files somewhere. Well, there was no need for this in the end, but it is worth mentioning what I found.

First was to come up with the command line:

mount -t afp  "afp:/at/;" /mnt/test

so this command mounts an afp volume with a guest login (make sure guest access in enabled under the afp service). It share is on the xserve under "Shared" and it mounts it in the folder "/mnt/test" (but this folder must exist)

So, to mount it before login I found AFP automounter StartupItem which I downloaded it from:
AFP automounter StartupItem

So, you need to place this folder in the /Library/StartupItems/, and it needs a file in /etc/ called AFPVolumes. In this text file you need to put the afp mount with username with a tab after it and the place you want to mount it i.e. "afp:/at/;" (with a tab) /mnt/Shared

Now this particular one connects with guest but it has spaces hence the speech marks. This only works if you enable "cleartext" in the file both in /Library/Preferences and ~/Library/Preferences.

You can use the command:

sudo defaults write /Library/Preferences/ afp_cleartext_allow 1

to get this to work, but it might work by default but I'm not sure.

No comments:

Post a Comment