SSH Keys

From SlackWiki
Jump to navigation Jump to search

Having to type an SSH password everytime may get annoying in some cases. Well there is thing called password-less SSH logins. First we need to create a key by issuing the following command from the local client machine:

ssh-keygen -t dsa

Now press enter on the location and the pass-phrase. Now we have made the actual key, so we can copy the key over to the remote server:

ssh-copy-id -i ~/.ssh/id_dsa.pub user@host

Now 'user' is the actual user of the remote server, and 'host' you replace with the servers IP or Hostname. Now it might ask if you wish to continue, you make sure you hit yes, and the password you type is the password for the user on the remote server. Now lets login:

ssh user@host

You will log right into the server without typing in a password. It will also not ask for a password when you are going to scp a file over, too.

To copy your key to another remote server, simply run the ssh-copy-id command again with another $USER@$HOST specified.