I'm trying to get gpg-agent to act as a keyring for my ssh keys, but for some reason ssh isn't picking it up. It starts on login with the following in /etc/profile.d/gpg-agent.sh:
#!/bin/sh
envfile="${HOME}/.gnupg/gpg-agent.env"
if test -f "$envfile" && kill -0 $(grep GPG_AGENT_INFO "$envfile" | cut -d: -f 2) 2>/dev/null; then
eval "$(cat "$envfile")"
else
eval "$(gpg-agent --daemon --enable-ssh-support --write-env-file "$envfile")"
fi
export GPG_AGENT_INFO # the env file does not contain the export statement
The appropriate environment variables $SSH_AGENT_INFO and $SSH_AGENT_PID are set, but trying to run ssh-add results in the message "Could not open connection to your authentication agent."