[Developers] sshkeychain and 10.4.9?
Tim Cutts
timc at chiark.greenend.org.uk
Tue Mar 27 10:30:00 CEST 2007
On 18 Mar 2007, at 10:13 pm, William Uther wrote:
> Hi,
> Just a quick note that sshkeychain has stopped working for me
> under MacOS 10.4.9 (well, it stopped working at the time I updated
> - I don't know if that is causal or just a random correlation). I
> traced the problem to that fact that sshkeychain no longer seems to
> be managing global environment variables for me. That means it
> cannot set SSH_AUTH_SOCK and then it can't work :).
>
> Setting SSH_AUTH_SOCK, if it isn't already set, in a login-script
> (~/.zshenv), with .e.g:
>
> export SSH_AUTH_SOCK=${SSH_AUTH_SOCK:-/tmp/${UID}/SSHKeychain.socket}
>
> solves the issue for me.
I use something a little more sophisticated, so that my ssh agent is
started even if SSHKeychain is not. I use the following shell
function in bash:
setup_ssh_agent() {
# Change the following to your preferred ssh key
local key=phobos2
# Check that the ssh-agent is running, and start it if not,
# using the same path that SSHKeychain uses
if [ "$SSH_AUTH_SOCK" = "" ]; then
pid=`ps cx -opid,command | awk '$2 ~ /^ssh-agent$/ {print $1}'`
if [ "$pid" = "" ]; then
eval `ssh-agent -a /tmp/$UID/SSHKeychain.socket` > /dev/null
else
SSH_AGENT_PID=$pid
SSH_AUTH_SOCK=/tmp/$UID/SSHKeychain.socket
export SSH_AGENT_PID SSH_AUTH_SOCK
fi
fi
# Add keys if they haven't been added already
ssh-add -l | grep -q $key || ssh-add -t 86400 $HOME/.ssh/$key
chmod 600 $SSH_AUTH_SOCK
}
and then later in my .bashrc:
# Only set up SSH in interactive shells
if [ -t ]; then
setup_ssh_agent
fi
Tim
More information about the developers
mailing list