Function to add ed25519 ssh-key to ssh-agent
This commit is contained in:
parent
2b7c59f8ab
commit
b1ce539942
2
zshenv
2
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"
|
||||
|
|
10
zshrc
10
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
|
||||
|
|
Loading…
Reference in New Issue