Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #GPG Agent & Yubikey
- #assuming you're using Ubuntu and ZSH
- #Install the packages
- sudo apt install gnupg2 gnupg-agent scdaemon pcscd
- #write the necessary config
- echo "enable-ssh-support" >> ${HOME}/.gnupg/gpg-agent.conf
- #Update zshrc
- cat <<EOF >> "${HOME}/.zshrc"
- #Making sure we're using gpg2
- alias gpg=gpg2
- # Start the gpg-agent if not already running
- if ! pgrep -x -u "${USER}" gpg-agent >/dev/null 2>&1; then
- gpg-connect-agent /bye >/dev/null 2>&1
- fi
- # Set SSH to use gpg-agent
- unset SSH_AGENT_PID
- if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
- export SSH_AUTH_SOCK="${HOME}/.gnupg/S.gpg-agent.ssh"
- fi
- # Set GPG TTY
- export GPG_TTY=$(tty)
- # Refresh gpg-agent tty in case user switches into an X session
- gpg-connect-agent updatestartuptty /bye >/dev/null
- EOF
- source "${HOME}/.zshrc"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement