Remember ssh keys for 24h

This commit is contained in:
Loic Nageleisen 2022-02-22 21:58:14 +01:00
parent 9a43154d80
commit 3069532db6
Signed by: lloeki
GPG key ID: 971B4D9F125CD31E

View file

@ -1,7 +1,7 @@
# start ssh agent, if no agent set
if [[ -n "${XDG_RUNTIME_DIR}" && -z "${SSH_AUTH_SOCK}" ]]; then
if ! pgrep -u "$USER" ssh-agent > /dev/null; then
ssh-agent -t 1h > "${XDG_RUNTIME_DIR}/ssh-agent.env"
ssh-agent -t 24h > "${XDG_RUNTIME_DIR}/ssh-agent.env"
fi
if [[ ! -S "${SSH_AUTH_SOCK}" ]] && [[ -f "${XDG_RUNTIME_DIR}/ssh-agent.env" ]]; then
source "${XDG_RUNTIME_DIR}/ssh-agent.env" > /dev/null