diff --git a/zshenv b/zshenv index 54a32d4..bf9123b 100644 --- a/zshenv +++ b/zshenv @@ -105,3 +105,5 @@ fi ## Specify ssh-agent socket path SSH_AGENT_SOCK="${HOME}/.ssh/socks/ssh_auth" SSH_AGENT_ENV="${HOME}/.ssh/socks/ssh_agent_env" +## ssh-keys path +SSH_ED25519_KEY="${HOME}/.ssh/id_ed25519" diff --git a/zshrc b/zshrc index 0d907a2..45f5c0d 100644 --- a/zshrc +++ b/zshrc @@ -335,6 +335,16 @@ function load-ssh-agent() { source "${SSH_AGENT_ENV}" } # }}} +# Add ed25519 ssh-key to ssh-agent {{{ +function load-ssh-ed25519() { + # If a ED25519 ssh-key is available + # AND not already loaded in ssh-agent + if [ -f "${SSH_ED25519_KEY}" ] && + ! ssh-add -l | grep -qi -- "(ed25519)"; then + ssh-add "${SSH_ED25519_KEY}" + fi +} +# }}} # Clear old entries in known_hosts {{{ function clearsshkey() { sed -i "${1}d" ~/.ssh/known_hosts