Can some one please tell me, for using SSH, why does a host also need to have a public and private key? And how can I generate a public/private key pair for myself?
|
feedback
|
migrated from stackoverflow.com Nov 17 '10 at 16:43
This question came from our site for professional and enthusiast programmers.
|
You need the host key so you know you are connecting to the right server and not a fake one. | |||
|
feedback
|
|
It differs from one distribution to another. On Ubuntu use this command:
It will generate two keys, one public (the one you will share to the server) and the other is private and you shall not share with anyone. Once the public key is copied in the ~/.ssh/authorized_keys in the server, you can login without being prompt for password. | |||
|
feedback
|
|
Public/private keys are like locks and keys: the server sends you a lock, but keeps the key, and then you lock your messages to the server. You need to send the server a lock as well so you can retrieve that data. | |||
|
feedback
|
For more information: | |||
|
feedback
|
|
Anyway to generate keys you should use | ||||
|
feedback
|