Oracle® Solaris 11.2 での Secure Shell アクセスの管理

印刷ビューの終了

更新: 2014 年 9 月
 
 

Secure Shell でのパスワードのプロンプトを減らす方法

Secure Shell の使用に際してパスフレーズやパスワードを入力しない場合は、エージェントデーモンを使用できます。ホストごとにアカウントが異なる場合は、セッションに必要な非公開鍵を追加します。

エージェントデーモンの起動は、次の手順で説明するように、必要に応じて手動で行うことができます。

  1. エージェントデーモンを起動します。
    mySystem% eval `ssh-agent`
    Agent pid 9892
  2. エージェントデーモンが起動していることを確認します。
    mySystem% pgrep ssh-agent
    9892
  3. 使用する非公開鍵をエージェントデーモンに追加します。
    mySystem% ssh-add
    Enter passphrase for /home/username/.ssh/id_rsa: <Type passphrase>
    Identity added: /home/username/.ssh/id_rsa(/home/username/.ssh/id_rsa)
    mySystem%
  4. Secure Shell セッションを開始します。
    mySystem% ssh myRemoteHost -l username

    パスフレーズを要求するプロンプトは表示されません。

使用例 1-3  ssh-add オプションを使用する

この例では、jdoe が 2 つの鍵をエージェントデーモンに追加します。–l オプションは、デーモンに格納されているすべての鍵を一覧表示するために使用します。セッションの最後に、–D オプションを使用して、エージェントデーモンからすべての鍵を削除します。

myLocalHost% ssh-agent
mySystem% ssh-add
Enter passphrase for /home/jdoe/.ssh/id_rsa: <Type 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: <Type passphrase>
Identity added:
/home/jdoe/.ssh/id_dsa(/home/jdoe/.ssh/id_dsa)

mySystem% ssh-add -l
md5 1024 0e:fb:3d:53:71:77:bf:57:b8:eb:f7:a7:aa:df:e0:d1
/home/jdoe/.ssh/id_rsa(RSA)
md5 1024 c1:d3:21:5e:40:60:c5:73:d8:87:09:3a:fa:5f:32:53
/home/jdoe/.ssh/id_dsa(DSA)

User conducts Oracle Solaris Secure Shell transactions
myLocalHost% ssh-add -D
Identity removed:
/home/jdoe/.ssh/id_rsa(/home/jdoe/.ssh/id_rsa.pub)
/home/jdoe/.ssh/id_dsa(DSA)