public_key » Revisions »
Differences
This shows you the differences between the selected revisions of the page.
2007-07-11 | 2007-07-11 | ||
no summary (190.76.9.181) | old revision restored, the description is openssh specific, please indicate so or generalize (martin) | ||
Line 9: | Line 9: | ||
Public key authentication solves this problem. You [[public_key#generate|generate a key pair]], consisting of a public key (which everybody is allowed to know) and a private key (which you keep secret and do not give to anybody). The private key is able to generate signatures. A signature created using your private key cannot be forged by anybody who does not have that key; but anybody who has your public key can verify that a particular signature is genuine. | Public key authentication solves this problem. You [[public_key#generate|generate a key pair]], consisting of a public key (which everybody is allowed to know) and a private key (which you keep secret and do not give to anybody). The private key is able to generate signatures. A signature created using your private key cannot be forged by anybody who does not have that key; but anybody who has your public key can verify that a particular signature is genuine. | ||
- | So you generate a key pair on your own computer, and you copy the public key as a single line to a server file called authorized_keys in a folder .ssh which you create in your user root folder, chmodding .ssh to 700 and the file to 600. The sshd_config file (typically in /etc/ssh) will also need these three settings: RSAAuthentication yes, PubkeyAuthentication yes, and AuthorizedKeysFile .ssh/authorized_keys. Then, when the server asks you to prove who you are, WinSCP can generate a signature using your private key. The server can verify that signature (since it has your public key) and allow you to log in. Now if the server is hacked or spoofed, the attacker does not gain your private key or password; they only gain one signature. And signatures cannot be re-used, so they have gained nothing. | + | So you generate a key pair on your own computer, and you copy the public key to the server under a certain name. Then, when the server asks you to prove who you are, WinSCP can generate a signature using your private key. The server can verify that signature (since it has your public key) and allow you to log in. Now if the server is hacked or spoofed, the attacker does not gain your private key or password; they only gain one signature. And signatures cannot be re-used, so they have gained nothing. |
There is a problem with this: if your [[public_key#private|private key]] is stored unprotected on your own computer, then anybody who gains access to that will be able to generate signatures as if they were you. So they will be able to log in to your server under your account. For this reason, your private key is usually encrypted when it is stored on your local machine, using a passphrase of your choice. In order to generate a signature, WinSCP must decrypt the key, so you have to type your passphrase. | There is a problem with this: if your [[public_key#private|private key]] is stored unprotected on your own computer, then anybody who gains access to that will be able to generate signatures as if they were you. So they will be able to log in to your server under your account. For this reason, your private key is usually encrypted when it is stored on your local machine, using a passphrase of your choice. In order to generate a signature, WinSCP must decrypt the key, so you have to type your passphrase. |