Recipes with ssh-add
command.
Simple usages
1
|
|
1 2 3 4 5 6 |
|
1 2 3 4 |
|
OSX specific
On OS X ssh-add
is integrated with the system keychain. If you give the -K
option, as in ssh-add -K
, when you add a key, that key’s password will be added to the keychain. As long as your keychain is unlocked, a key that has been stored in this way doesn’t require a password to be loaded into the agent.
All keys with their password stored in the keychain will automatically be loaded when you run ssh -A
. This happens automatically on login.
When a password has been stored in keychain, ssh -K -d key-file
both removes the key from the agent and removes it password from the keychain. Without -K
, -d
does not change the keychain and the key can be reloaded without a password. -D
silently ignores -K
.
Recipe: Connecting without a passphrase
ssh-add
is commonly used to simplify ssh
command.
In the following example, you need to specify a private key file in some location.
1 2 3 4 5 6 |
|
By adding the private key to the authentication agent with ssh-add
, you can simplify the ssh
command as follows:
1 2 3 4 5 6 7 8 9 |
|