Secure Shell の使用に際してパスフレーズやパスワードを入力しない場合は、エージェントデーモンを使用できます。ホストごとにアカウントが異なる場合は、セッションに必要な非公開鍵を追加します。
エージェントデーモンの起動は、次の手順で説明するように、必要に応じて手動で行うことができます。
mySystem$ eval `ssh-agent` Agent pid 9892
mySystem$ pgrep ssh-agent 9892
mySystem$ ssh-add Enter passphrase for /home/username/.ssh/id_rsa: passphrase Identity added: /home/username/.ssh/id_rsa(/home/username/.ssh/id_rsa) mySystem$
mySystem$ ssh myRemoteHost -l username
パスフレーズを要求するプロンプトは表示されません。
この例では、jdoe が 2 つの鍵をエージェントデーモンに追加します。セッションの最後に、jdoe は、エージェントデーモンからすべての鍵を削除します。
mySystem$ ssh-agent
mySystem$ ssh-add
Enter passphrase for /home/jdoe/.ssh/id_rsa: passphrase
Identity added: /home/jdoe/.ssh/id_rsa(/home/jdoe/.ssh/id_rsa)
mySystem$ ssh-add /home/jdoe/.ssh/id_dsa
Enter passphrase for /home/jdoe/.ssh/id_dsa: passphrase
Identity added:
/home/jdoe/.ssh/id_dsa(/home/jdoe/.ssh/id_dsa)
mySystem$ ssh-add -l
SHA256:OX5V4xxoVozwqdZfAbykwawMuwVM+sfc+ThMeai8r9
/home/jdoe/.ssh/id_rsa(RSA)
SHA256:OX5V4xxoVozwqdZfAbykwawMuwVM+sfc+ThMeai8r9
/home/jdoe/.ssh/id_dsa(DSA)
ユーザーが Secure Shell トランザクションを実行
mySystem$ ssh-add -D Identity removed: /home/jdoe/.ssh/id_rsa(/home/jdoe/.ssh/id_rsa.pub) /home/jdoe/.ssh/id_dsa(DSA)