keychain

ずっと使っているが便利。

ひとつの ssh-agent の恩恵を shell たちでわけあうためのツール。実行するだけで、~/.keychain 以下に、sh とか csh でsource するためのスクリプトを生成してくれる。

むかしは自分で /tmp/ssh-モゲ以下とか探して拾っていたが、いろんな状況に追従するのがめんどくさいので、すでにツールがあるなら使うべし。

Description: An OpenSSH key manager
Keychain is an OpenSSH key manager, typically run from ~/.bash_profile. When run, it will make sure ssh-agent is running; if not, it will start ssh-agent. It will redirect ssh-agent's output to ~/.ssh-agent, so that cron jobs that need to use ssh-agent keys can simply source this file and make the necessary passwordless ssh connections. In addition, when keychain runs, it will check with ssh-agent and make sure that the ssh RSA/DSA keys that you specified on the keychain command line have actually been added to ssh-agent. If not, you are prompted for the appropriate passphrases so that they can be added by keychain.

ただ、引数なしで keychain を実行すると、stdout に、うれしそうにcurses 色付きのメッセージを出すのが厨くさい。

keychain -q > /dev/null
if [ -f ~/.keychain/ayachan-sh ]; then
	source ~/.keychain/ayachan-sh
fi

ayachan はおれのノートの hostname(娘の名前だ)