Update SSH config to automatically add keys to agent.

Update ZSH config to automatically start the SSH agent.
This commit is contained in:
Hans Goor 2024-11-18 17:24:33 +01:00
parent 194c9d6982
commit 7ed3d3dcc8
Signed by: eyedevelop
SSH key fingerprint: SHA256:Td89veptDEwCV8J3fjqnknNk7SbwzedYhauyC2nFBYg
3 changed files with 19 additions and 1 deletions

View file

@ -1,3 +1,11 @@
#
AddKeysToAgent yes
UseKeychain yes
Host localhost
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
## --- Jupiter ---
# -- Physical servers --
Host jupiter-thebe-local

View file

@ -1,5 +1,6 @@
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
export PATH="${PATH}:${HOME}/.local/bin"
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"

View file

@ -1,3 +1,12 @@
#!/bin/bash
export SSH_AUTH_SOCK="${XDG_RUNTIME_DIR}/ssh-agent.socket"
if [[ -z "${SSH_CONNECTION}" ]]; then
if ! pgrep -u "$USER" ssh-agent >/dev/null; then
ssh-agent > "$TMPDIR/ssh-agent.env"
fi
if [[ ! -f "${SSH_AUTH_SOCK}" ]]; then
source "$TMPDIR/ssh-agent.env" >/dev/null
fi
fi