startKeychain – bash utility to start ssh-agent
For my (and your) future reference, here’s a function to put on your .bashrc or .bash_profile, you can invoke it later at any time to start/re-start your ssh-agent.
function startKeychain {
killall ssh-agent
rm ~/.keychain/*
keychain id_rsa
HOSTNAME=`hostname`
source ~/.keychain/${HOSTNAME}-sh
}
Then at any time, the “command” startKeychain will be available on your command line.
Output should look something like this:
gubatron@gubatron-desktop:~$ startKeychain KeyChain 2.6.8; http://www.gentoo.org/proj/en/keychain/ Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL * Initializing /home/gubatron/.keychain/gubatron-desktop-sh file... * Initializing /home/gubatron/.keychain/gubatron-desktop-csh file... * Initializing /home/gubatron/.keychain/gubatron-desktop-fish file... * Starting ssh-agent * Initializing /home/gubatron/.keychain/gubatron-desktop-sh-gpg file... * Initializing /home/gubatron/.keychain/gubatron-desktop-csh-gpg file... * Initializing /home/gubatron/.keychain/gubatron-desktop-fish-gpg file... * Starting gpg-agent * Adding 1 ssh key(s)... Identity added: /home/gubatron/.ssh/id_rsa (/home/gubatron/.ssh/id_rsa)
Comments are welcome to improve it, I’m not an ssh-agent expert, but this seems to do the work.
[SOLVED] Issue with KDE 4.4.2 and Dolphin always asking my ssh passwords whenever I browsed folder I checked out from a remote subversion repository.
Did this help you? Tip $1 Tip $2 Tip $5
June 25th, 2010 at 5:04 pm
[...] startKeychain – bash utility to start ssh-agent (gubatron.com) [...]