New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

Start a Discussion

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Operating System General OS operation information and support

LaunchDaemon Access to System Keychain

Post Reply New Thread Subscribe

Thread Tools

Member Since: Oct 20, 2011
Posts: 3
rdasilva is on a distinguished road

rdasilva is offline
Hi guys, been tearing my hair out for three days since getting a Mac Mini server. I'm trying to periodically and automatically SSH a file to a remote site from my Server using launchctl, which I have been learning, having used 'cron' with (Gentoo) 'keychain' for years. I have a running shell script run from a System LaunchDaemon that performs the necessary SSH commands (and has done for a couple of years successfully on Linux, so no problems there), but I'm having no success retrieving the passphrase that I've attempted to store in the System Keychain (I think). To add the passphrase there I've tried just about everything, including just doing 'sudo sftp -i <path-to-private-key>' which asks for the passphrase and even though I choose store it, in the next user session it asks it again. Do I need to do anything special in the shell script to use this stored passphrase from the keychain? I used to have a line like this in the Linux version of the script:

[ -z "$HOSTNAME" ] && HOSTNAME=`uname -n`
. $HOME/.keychain/$HOSTNAME-sh 2>/dev/null
ssh-add -l 2>/dev/null | grep -q id_rsa || exit 1

which retrieved the appropriate keys into memory and meant I only ever had to type the passphrase once and then it would remember until the server rebooted.

Does anyone have a clue how to achieve this with a Mac? I should add that in my plist file, stored in /Library/LaunchDaemons/, I use the "UserName" key with the user that I want to run the script. Mind you, in three days I've also tried without this, letting root run the script, but this also asks for the passphrase each time the shell script is run.

Other than desperately searching the Internet without finding anything concrete I really have nothing to go on. Anyone can offer some help? I can't imagine no one has done something like this...
QUOTE Thanks

Member Since: Oct 20, 2011
Posts: 3
rdasilva is on a distinguished road

rdasilva is offline
Well, for the time being I have it working with good old keychain (Keychain - Funtoo Linux) bypassing the Mac KeyChain so at least I spare some of the remaining hair. Would still be nice to know how this can be done the proper Mac way though...
QUOTE Thanks

Post Reply New Thread Subscribe

« Dock an Icon | Accidentally uninstalled part of Avast! the rest is untouchable. »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Starter
Last Post
"Preferences" menu of keychain access bobmac9 OS X - Apps and Games 8 07-07-2010 08:11 PM
Login keychain Wardy OS X - Operating System 1 06-17-2010 06:22 AM
How can I disable spell check system wide and internet access temporarily JDog666 OS X - Operating System 1 05-29-2010 12:29 PM
Keychain Access catarrhine OS X - Operating System 0 07-10-2007 05:33 PM
Safari 'Please enter keychain password'...really annoying! HELP! jetpilot_aust OS X - Operating System 7 04-17-2007 06:48 AM

All times are GMT -4. The time now is 11:59 PM.

Powered by vBulletin
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.

Welcome to

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!

(4 digit year)

Already a member?