Linux VPS and server more secure settings putty SSH use key login _linux

Source: Internet
Author: User
Tags ssh account security vps vps server

In the previous article to ensure that Linux VPS and server more secure Xshell set key login article has been shared to Xshell use the key to login to our VPS server to ensure the safety of the machine, but many students are not like the old left with Xshell, There are still a lot of use putty login ssh, so a separate article to share with Putty set the key to login to the Linux VPS host method.

PS: If we need to use putty must go to the normal download station is the best official website download, the so-called crack version, green version, Chinese compact version and so on may have been implanted Trojan, this will affect our account security.

First step, Generate key

See a lot of tutorials mentioned with Puttygen.exe file can generate a key, but there may be server refused our key such a landing error, so we use the VPS to remotely set the key, and then download to the local.

According to the illustration above, after landing to SSH, we first enter ssh-keygen-t RSA and then we will ask us to determine the path we will automatically create a/root/.ssh folder directory, and then enter the key password after entering two times to continue the return key can be seen in the directory.

We will need to download the Id_rsa and id_rsa.pub in the Root/.ssh directory to a local backup.

Step two, modify the sshd configuration file

A-Change the id_rsa.pub name in Root/.ssh to Authorized_keys and set permissions with Chmod Authorized_keys.

B-Find/etc/ssh/sshd_config and remove the # comments in front of the rsaauthentication and Pubkeyauthentication lines.

C-Restart the sshd service.

Debian/ubuntu execution:/etc/init.d/ssh restart
centos execution:/etc/init.d/sshd restart

Step three, client configuration key

We open the Puttygen.exe file and load the key.

Enter the key password set in SSH.

Save the private key.

The saved file name can be set to ID_RSA.PPK, or you can customize the name but the suffix must be PPK, which we need to use later.

Fourth step, set up Putty certification link

The normal login, may begin to require us to enter the key password.

Step fifth, modify the sshd configuration file again

Modify the/etc/ssh/sshd_config file to find the "yes" after passwordauthentication to No

and restart sshd.

Debian/ubuntu execution:/etc/init.d/ssh restart
centos execution:/etc/init.d/sshd restart

So our putty login using the key is also configured to complete, even if they know our root password is not good landing, so to a few local files need to ensure security, as long as your computer security, your VPS is relatively adequate security.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.