Is there a way to mount an AFP share at boot so it is accessible to the system without a user logged in?

I would like to run scripts via SSH or as a daemon on boot that check files on my AFP share. Unfortunately, the shares don't mount until a user logs in.


Not sure that you can. I would think for security reasons a user has to be logged in, so that a set of credentials can be used. There's probably some scripts that are run pre-login though, so I suppose if you specify your credentials in there it would be fine.

  • Actually, having a user logged in when the mount happens makes tons of sense. Someone will see an error and connect it to something that is happening now. Next, the user can provide credentials and thirdly, if the credentials are stored in a user keychain, then it's more secure on multi user systems. – bmike Jul 8 '11 at 16:29
  • @bmike - I agree. Why 'actually'? Did you think I was arguing that a user shouldn't be logged in, or...? – Harv Jul 9 '11 at 23:50
  • Im scratching my head too about actually - I think I wanted to say additionally. – bmike Jul 10 '11 at 0:34

Indeed you can script it all from terminal.

You will want to learn a little about launchd - that will specify when the mount will happen. At $5 the Lingon app from the App Store is great if you don't want to learn launchd configuration files.

Next, you'll need a command to make the AFP mount.

Last, you might learn security command to store or retrieve a password from the keychain if you don't want to store your afp password in the script.

Each of these should be easy to learn more with a few internet searches.

  • Ooh. Retrieve passwords from keychain. I like it. – Harv Jul 9 '11 at 23:51

I would look into AutoFS. You can have AFP mounted on demand (see page 14 of the linked PDF).


Here you go. A bit outdated, but you can see how to do what you want from here.



Yes, this can be done, and it's actually necessary when you want the share point available to something like servers which are started and run without a user logged in.

I did this years ago for something, and just again needed to do it, but my notes were inadequate. After a lot of fiddling, I've written enough details out so that I'll never have to do that again (I hope).

You combine launchd and a script, but there's some details that many other posts fail to mention. I captured them (at least for my setup).

All the nitty gritty details are here:


  • 1
    Welcome to Ask Different and thanks for posting an answer greg! Can you please summarize the contents of the link you posted? Link have a tendency to disappear over time, leaving an answer that is not relevant to those who may find your answer down the road. Thank you! – daviesgeek May 23 '12 at 3:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .