Last updated：2021-08-04 11:26:07
Tools required: PuTTY and PuTTYgen
Open the PuTTYgen tool, set 2048 in the lower right corner, and then click “Generate” to generate the key. The generation can be accelerated by moving the pointer left and right.
After the key is generated, you can set the password for the key. Click “Save private key” to save the key.
The public key must also be copied. It can be copied to a file first and then you can close this window, or this window may not be closed and you can copy the key when you use it.
Open putty, enter the KEC instance address, and then click “Open” to log in to the KEC instance with the user name and password (The CentOS account user name is root. When the password is entered, putty will not display it. Press “Enter” after you enter the password.)
Create an SSH key directory and SSH key file.
mkdir /root/.ssh (Create an SSH key directory) touch /root/.ssh/authorized_keys (Create an SSH key file)
Edit the public key file and copy the public key.
Press “I” on the keyboard to start editing, paste the public key copied, and press “Esc” to exit editing. Enter :wq to save and exit.
If there is no “vim” command, run “yum -y install vim” to install it.
Press “I” on the keyboard to enter the edit mode, and perform the modification.
PasswordAuthentication no # Login with the password is not allowed.
The following figures show the modification.
Press Esc to exit the editing.
Enter :wq to save and exit.
systemctl restart sshd.service
The configuration has been completed, and you can only log in to the KEC instance with the key next time.
Did you find the above information helpful?
Please give us your feedback.
Thank you for your feedback.