Most users will use SSH to connect to the Linux server. Under win10 system, we will use openssh to connect, as shown in the following figure:
Like this: the terminal inputs SSH
This is what it has (as if win10 has it by default).
Then the key pair is generated:
ssh-keygen -t rsa
Then according to the prompt information, you can choose according to your personal needs. Here is the default (three consecutive press returns are OK).
The generated key pair is saved in the. SSH directory of the current user’s root directory by default (C: users / username \. SSH)
Then we change the ID to the public key_ rsa.pub Upload to the Linux server (save it to the root directory ~ /. SSH / of the user you want to connect to, or create it if there is no. SSH directory):
As for the upload method, I can use various ways. I use lrzsz tool (which can be installed by Yum), and can be directly dragged and uploaded through xshell.
After uploading the ID in Linux_ rsa.pub Rename to authorized_ Keys, change the file permission to 600, change the. SSH directory permission to 700:
mv id_rsa.pub authorized_keys chmod 600 authorized_keys chmod 700 .ssh
Now connect to the Linux server through the xshell:
As shown in the figure above, select the public key, browse the file with the user key, and select another ID of the key just generated_ RSA. If the newly generated key is the default operation and no password is set, the password item will be empty. Confirm to connect successfully.
Here, I use the xshell to verify whether the configuration is successful. However, after the configuration is successful, the use is not limited to this. For example, it can also be used for remote development of vscode remote SSH connection server.