Skip to content

Instantly share code, notes, and snippets.

@starstuck
Created June 17, 2019 09:25
Show Gist options
  • Save starstuck/b1f9f81cc16eede8190b50931b802b87 to your computer and use it in GitHub Desktop.
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.
# -*- 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