GPG SSH Yubikey on a Mac

PUBLISHED ON JUN 12, 2020 — HOWTO

Script to load the GPG SSH Yubikey on a Mac for ZSH

Add below to .zprofile

export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
gpgconf --launch gpg-agent

Create a bin/gpg-restart.sh

#!/bin/bash

echo "kill gpg-agent"
code=0
while [ 1 -ne $code ]; do
        killall gpg-agent
        code=$?
        sleep 1
done

#echo "kill ssh"
#killall ssh

#echo "kill ssh muxers"
#for pid in `ps -ef | grep ssh | grep -v grep | awk '{print $2}'`; do
        #kill $pid
#done

echo "restart gpg-agent"
eval $(gpg-agent --daemon)

echo
echo "All done. Now unplug / replug the NEO token."
echo
TAGS: SSH