Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #GPG Agent & Yubikey
  2. #assuming you're using Ubuntu and ZSH
  3.  
  4. #Install the packages
  5. sudo apt install gnupg2 gnupg-agent scdaemon pcscd
  6.  
  7. #write the necessary config
  8. echo "enable-ssh-support" >> ${HOME}/.gnupg/gpg-agent.conf
  9.  
  10. #Update zshrc
  11. cat <<EOF >> "${HOME}/.zshrc"
  12. #Making sure we're using gpg2
  13. alias gpg=gpg2
  14.  
  15. # Start the gpg-agent if not already running
  16. if ! pgrep -x -u "${USER}" gpg-agent >/dev/null 2>&1; then
  17. gpg-connect-agent /bye >/dev/null 2>&1
  18. fi
  19.  
  20. # Set SSH to use gpg-agent
  21. unset SSH_AGENT_PID
  22. if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
  23. export SSH_AUTH_SOCK="${HOME}/.gnupg/S.gpg-agent.ssh"
  24. fi
  25.  
  26. # Set GPG TTY
  27. export GPG_TTY=$(tty)
  28.  
  29. # Refresh gpg-agent tty in case user switches into an X session
  30. gpg-connect-agent updatestartuptty /bye >/dev/null
  31. EOF
  32.  
  33. source "${HOME}/.zshrc"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement