Created
June 17, 2019 09:25
-
-
Save starstuck/b1f9f81cc16eede8190b50931b802b87 to your computer and use it in GitHub Desktop.
Script to load and share ssh-agent across all terminal session on single system. Add it to your ~/.profile.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- sh -*- | |
export SSH_AGENT_FILE=~/.ssh/agent | |
start() { | |
(umask 077; ssh-agent >| ${SSH_AGENT_FILE}) | |
. ${SSH_AGENT_FILE} | |
ssh-add | |
} | |
if [ ! -f "${SSH_AGENT_FILE}" ]; then | |
start | |
else | |
. ${SSH_AGENT_FILE} | |
if [ ! -S "${SSH_AUTH_SOCK}" ]; then | |
start | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment