Skip to content

Instantly share code, notes, and snippets.

@beli-sk
beli-sk / profile_ssh_agent
Created July 17, 2014 18:19
Bash profile snippet for starting and reusing SSH agent on login
### Start SSH agent if not running
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo -n "Initialising new SSH agent... "
/usr/bin/ssh-agent -t 3600 | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo done
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}"