# Check PS1 to determine if it's a login shell
if [ "$PS1" ]; then
SSH_ENV=$HOME/.ssh/env-$HOSTNAME
if [ -f "$SSH_ENV" ]; then
source $SSH_ENV > /dev/null
fi
ps $SSH_AGENT_PID 2> /dev/null 1>&2
if [ $? != 0 ]; then
echo "$(date) : Starting SSH agent on $HOSTNAME" | tee -a $HOME/.ssh/agent.log
ssh-agent > $SSH_ENV
chmod 600 $SSH_ENV
source $SSH_ENV
ssh-add
fi
fi
I searched and didn't find, and had to figure stuff out... I hope to save you the trouble.
Thursday, April 23, 2009
Automatically start ssh-agent
The following in my .bashrc starts ssh-agent and adds keys automatically whenever I open a shell, if it's not already running:
Subscribe to:
Post Comments (Atom)
Followers
Blog Archive
-
▼
2009
(15)
-
▼
April
(11)
- Run a TFTP server on a Mac
- Run a DHCP server on OS X
- Remove old Eclipse workspace selections
- Modifying bash $PATH
- Automatically start ssh-agent
- Use tkdiff to view changes in subversion
- Use python to decode base64 data
- Eclipse/PyDev on a Mac
- Rollback a SVN change
- Modifying initrd with a Mac
- Build squashfs tools for Mac OS X
-
▼
April
(11)
No comments:
Post a Comment