Differences

This shows you the differences between the selected revisions of the page.

public_key 2016-06-14 public_key 2023-08-01 (current)
Line 1: Line 1:
====== Using Public Keys for Authentication ====== ====== Using Public Keys for Authentication ======
-//This article explains public key authentication in general. You may want to see guide to [[guide_public_key|setting up public·key authentication]] instead.//+//This article explains public key authentication in general. You may want to see the guide to [[guide_public_key|setting up public-key authentication]] instead.//
//Do not confuse your user key pair used for authentication with [[ssh_verifying_the_host_key|host public key verification]]. Learn about [[ssh_keys|all SSH key types]].// //Do not confuse your user key pair used for authentication with [[ssh_verifying_the_host_key|host public key verification]]. Learn about [[ssh_keys|all SSH key types]].//
- 
-NOTE TO AUTHOR  
-REMAINS TO ADD 
-EXACT INSTRUCTION TO SETUP WINSCP'S PRIVATE KEY  
-AS THIS IS THE #1 REASON WHY PEOPLE END UP ON THIS PAGE 
===== Introduction ===== ===== Introduction =====
Line 19: Line 14:
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. 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 [[#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 [[#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.
This can make public-key authentication less convenient than password authentication: every time you log in to the server, instead of typing a short password, you have to type a longer passphrase. One solution to this is to use an authentication agent, a separate program which holds decrypted private keys and generates signatures on request. WinSCP can use PuTTY's authentication agent, called [[ui_pageant|Pageant]]. When you begin a Windows session, you start Pageant and load your private key into it (typing your passphrase once). For the rest of your session, you can start WinSCP any number of times and Pageant will automatically generate signatures without you having to do anything. When you close your Windows session, Pageant shuts down, without ever having stored your decrypted private key on disk. Many people feel this is a good compromise between security and convenience. This can make public-key authentication less convenient than password authentication: every time you log in to the server, instead of typing a short password, you have to type a longer passphrase. One solution to this is to use an authentication agent, a separate program which holds decrypted private keys and generates signatures on request. WinSCP can use PuTTY's authentication agent, called [[ui_pageant|Pageant]]. When you begin a Windows session, you start Pageant and load your private key into it (typing your passphrase once). For the rest of your session, you can start WinSCP any number of times and Pageant will automatically generate signatures without you having to do anything. When you close your Windows session, Pageant shuts down, without ever having stored your decrypted private key on disk. Many people feel this is a good compromise between security and convenience.
Line 28: Line 23:
To generate a key pair, use the [[ui_puttygen|PuTTYgen]] application. To generate a key pair, use the [[ui_puttygen|PuTTYgen]] application.
 +
 +You can start PuTTYgen directly from [[ui_login_authentication|Authentication page]] of Advanced Site Settings dialog. If you start PuTTYgen this way, WinSCP will automatically pick up the generated key.
===== [[private]] Private Keys ===== ===== [[private]] Private Keys =====
-Different file formats are used to store SSH-2 private keys. WinSCP supports PuTTY format, as authors of PuTTY [[&url(keyformat)|claim that it is the best one]]. +Different file formats are used to store SSH private keys. WinSCP supports PuTTY format, as authors of PuTTY [[&url(keyformat)|claim that it is the best one]].
-WinSCP also recognizes (but does not accept) the other two formats (OpenSSH and ssh.com), and it can convert the keys to PuTTY format for you (&beta_feature) or suggest you to convert them (//Stable version//). To convert the key file you can also use ''[[commandline#keygen|/keygen]]'' command-line switch or [[ui_puttygen|PuTTYgen]] application.+WinSCP also recognizes (but does not accept) the other two formats (OpenSSH and ssh.com), and it can convert the keys to PuTTY format for you. To convert the key file you can also use ''[[commandline#keygen|/keygen]]'' command-line switch or [[ui_puttygen|PuTTYgen]] application.

Last modified: by 96.125.201.255