Target: System1 connect to system2 computer via SSH
- Generate private key (Id_rsa) & Public key (id_rsa.pub)
- Id_rsa is system1 . to use, such as the Windows side
- Id_rsa.pub you want to use the past system2 , this server must have the Openssh-server service installed (sshd)
- put Id_rsa.pub append to system2 's ~/.ssh/authorized_keys file
- And be sure to log in to the server username, such as root
- Find an environment where you can run Ssh-keygen, Windows is available Cygwin
The steps are as follows:
Ssh-keygen - t RSAEnter file in which to save the key (~/.ssh/id_rsa): Created directory ' ~/.ssh '. Enter passphrase (empty for no passphrase): Enter same passphrase Again:your identification have been saved in ~/.ssh/ Id_rsa. Your public key have been saved in ~/.ssh/id_rsa.pub.The key fingerprint is:1c:fe:8d:10:b5:32:09:95:51:48:df:45:ef:74 : 5D:DC [email protected]the key ' s randomart image is:+--[RSA 2048]----+|. o+=o. o.o| |. o+ o.. e| | * O. =|| o = o.| | S. | | o O | | O. || || |+-----------------+
Ssh-keygen parameter Description:
-T type Specifies the type of key to create. The possible values are "RSA1" for protocol version 1 and "DSA", "ECDSA" or "RSA" for Protoco L version 2.
Cat ~/. ssh/id_rsa.pub > ~/. ssh/authorized_keys
Note: PUTTYGEN.EXE generated with putty will not be compatible with OpenSSH, resulting in server refused our key error at logon
Practice: To copy the private key (ID_RSA), I use VIM or cat to open the Id_rsa file and then right-click on the mouse to copy the Clipboard under Windows, save to a text to PUTTYGEN.EXE file/load private Key to use. Then click on Save private key, which will be used for this file.
1. Open Putty.exe, set Connection/data/auto-login username, here I log in with root
2.ssh/auth/private key file for authentication: Click Browser to select the file to which you saved the private key (. PKK), which is the archive for save private key .
Windows Putty link to linux password free