Saturday, December 30, 2006

SSH-Keys to simplify SSH Logins

By creating an ssh key you can login to a remote machine multiple times with only one password.

Setup: Create the ssh-key.

Create the ssh-key with the following command. Hit enter; pick a good passphrase.
ssh-keygen -t rsa
Copy the resulting public key to the remote machine:
scp ~/.ssh/
Enter you password.

Using ssh-agent.

The following command adds your new ssh key to your 'keyring'. You will be prompted for the passphrase.
[If the above command fails, then ssh-agent is not running. Start it with eval `ssh-agent`.]

Now you won't be prompted for the passphrase again until the next time you log in. You can ssh into the remote machine using ssh as usual without being prompted for a password.