Skip to content

Instantly share code, notes, and snippets.

@tuxfight3r
Created January 27, 2015 14:52
Show Gist options
  • Save tuxfight3r/99d3938abe6cc99bb3de to your computer and use it in GitHub Desktop.
Save tuxfight3r/99d3938abe6cc99bb3de to your computer and use it in GitHub Desktop.
ssh-agent tricks
##SSHAGENT PPID TRICK for DESKTOP
#source ~/.ssh-agent.sh in your .bashrc
SSHAGENTPPID=$(ps -eo ppid,comm|awk '/ssh-agent/ {print $1}')
if [ -n "$SSHAGENTPPID" ]
then
export SSH_AUTH_SOCK=`ls /tmp/ssh*/agent.$SSHAGENTPPID`
export SSH_AGENT_PID=`pgrep -P $SSHAGENTPPID ssh-agent`
echo "SSH agent pid $SSH_AGENT_PID";
else
echo "SSH agent is not started !!!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment