Results 1 to 2 of 2
  1. #1

    Member Since
    Oct 20, 2011
    Unhappy LaunchDaemon Access to System Keychain
    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...

  2. #2

    Member Since
    Oct 20, 2011
    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...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Keychain access
    By hoody in forum Switcher Hangout
    Replies: 7
    Last Post: 11-07-2013, 06:20 PM
  2. How to access Keychain?
    By MyBad in forum macOS - Operating System
    Replies: 6
    Last Post: 11-30-2011, 06:08 PM
  3. Keychain access
    By MacGrumpy in forum macOS - Operating System
    Replies: 2
    Last Post: 11-22-2011, 12:06 PM
  4. Keychain Access
    By ooptec in forum macOS - Operating System
    Replies: 0
    Last Post: 09-16-2008, 09:01 AM
  5. Keychain Access
    By chrisregentb in forum macOS - Operating System
    Replies: 0
    Last Post: 08-24-2006, 03:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts