ssh: ssh-agent eingebaut

This commit is contained in:
Michael Grote 2022-07-01 14:24:48 +02:00
parent f6b5c14b95
commit 4674600a55
2 changed files with 24 additions and 0 deletions

View file

@ -4,6 +4,27 @@ if command -v tmux &> /dev/null && [ -z "$TMUX" ]; then
tmux attach -t default || tmux new -s default tmux attach -t default || tmux new -s default
fi fi
### ssh-agent
# https://rabexc.org/posts/pitfalls-of-ssh-agents
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
(umask 066; /usr/bin/ssh-agent > "${SSH_ENV}")
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add;
}
# Source SSH settings, if applicable
if [ -f "${SSH_ENV}" ]; then
. "${SSH_ENV}" > /dev/null
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent;
}
else
start_agent;
fi
### PS1 ### PS1
# git-symbole: * unstaged, + staged, $ stashed, % untracked # git-symbole: * unstaged, + staged, $ stashed, % untracked
export GIT_PS1_SHOWUNTRACKEDFILES=1 export GIT_PS1_SHOWUNTRACKEDFILES=1

View file

@ -1,3 +1,6 @@
### ssh-agent
AddKeysToAgent yes
### grote.lan ### grote.lan
Host dokuwiki2.grote.lan Host dokuwiki2.grote.lan
Host qmk.grote.lan Host qmk.grote.lan