Managing Secure Shell Access in Oracle® Solaris 11.2

Exit Print View

Updated: September 2014
 
 

How to Reduce Password Prompts in Secure Shell

If you do not want to type your passphrase and your password to use Secure Shell, you can use the agent daemon. If you have different accounts on different hosts, add the keys that you need for the session.

You can start the agent daemon manually when needed, as described in the following procedure.

  1. Start the agent daemon.
    mySystem% eval `ssh-agent`
    Agent pid 9892
  2. Verify that the agent daemon has been started.
    mySystem% pgrep ssh-agent
    9892
  3. Add your private key to the agent daemon.
    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. Start a Secure Shell session.
    mySystem% ssh myRemoteHost -l username

    You are not prompted for a passphrase.

Example 1-3  Using ssh-add Options

In this example, jdoe adds two keys to the agent daemon. The –l option is used to list all keys that are stored in the daemon. At the end of the session, the –D option is used to remove all the keys from the agent daemon.

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)