Due to work needs, we often need to access the remote Ubuntu server from the windows host. It’s very troublesome to enter the account and old password every time, so we can automatically log in to the remote host after simple setting with reference to the online tutorial, which is very convenient.
Although putty also provides putty Gen Exe generates the public / private key, but the key format is different from that generated by the Linux host. The format needs to be modified manually, so the Linux host generates the key itself.
First log in to the Linux host. The specific process is as follows:
1. Generate public key and key
Generating public/private rsa key pair.
Enter file in which to save the key (/home/verdana/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/verdana/.ssh/id_rsa.
Your public key has been saved in /home/verdana/.ssh/id_rsa.pub.
The key fingerprint is:
51:51:da:44:28:b5:83:de:d2:1e:60:4f:81:c9:f1:1a [email protected]
Note that passphrase is left blank.
2. Append the public key content to authorized_ keys
[email protected]:~/.ssh$ touch authorized_keys
[email protected]:~/.ssh$ cat id_rsa.pub >> authorized_keys
3. Download the key and convert it to a format recognized by putty
Putty cannot recognize the key generated by the Linux host, so it needs to use putty Exe conversion.
a) Use FTP software or other methods to generate the key ID_ Copy RSA to the client host, where my client is vista
b) Open puttygen Exe, click: Convert – > import key – > save key (such as id_rsa. PPK) on the menu, and the key conversion is completed. Password protection is not set here
4. Set putty
a) Session, host name filled in:[email protected], user is the login name of your Linux host, and remote host is the IP or remote host domain name, such as:[email protected]。
b) Connect – > SSH – > authentication – > Browse, select the key just converted (id_rsa. PPK), and then save the session.
5. Use cygwin?
If you use the SSH of cygwin to log in to the remote server, you only need to put the key ID generated in step 3_ RSA (without any conversion) copy to cygwin user’s SSH directory is enough.