The process of using SSH key to login to VPS in Debian

Source: Internet
Author: User
Tags ssh vps port number
Use SSH login VPS generally use the ip+ port, enter username and password to log in
In order to enhance the security of the VPS, use the public key and the private key way to login VPS

The specific methods are:

Generate key on Linux remote server:ssh-keygen-t RSA

And then you can get a carriage.

Generating public/private RSA key pair.

Enter file in which to save the key (/ROOT/.SSH/ID_RSA)://Direct return
Created directory '/root/.ssh '.
Enter passphrase (empty for no passphrase)://Enter key password
Enter same Passphrase again://Repeat Key password
Your identification has been saved In/root/.ssh/id_rsa. Tip the public and private keys are already stored in the/root/.ssh/directory
Your public key has been saved in/root/.ssh/id_rsa.pub.
The key fingerprint is:
15:23:A1:41:90:10:05:29:4C:D6:C0:11:61:13:23:DD root@localhost
The key ' s Randomart image is:
+--[RSA 2048]----+
|=& @Bo +o o.o |
|=o=. E O. o |
| .   .      . |
|       . |
| S |
| |
| |
| |
| |
+-----------------+

The generated private key Id_rsa is then downloaded. The Putty private key PPK file is then generated locally with the Puttygen tool
At the same time, the Id_rsa.pub file generated on the VPS is renamed Authorized_keys
You can execute the following command:
Mv/root/.ssh/id_rsa.pub/root/.ssh/authorized_keys
Then the permission to modify this file is 600
chmod 600/root/.ssh/authorized_keys
This completes the VPS on the generation of public key.
You will then need to configure SSH for the associated
Modify the/etc/ssh/sshd_config file to change the values after Rsaauthentication and pubkeyauthentication to Yes and save them.
Restart the sshd service and perform/etc/init.d/ssh restart.
Here is the action to generate PPK as shown

Select conversion

Select Import Key, which is the Id_rsa file generated from the VPS

Enter the password you just set
Then select Save As Private key key

Use PPK to log in
Open Putty Enter the IP port number and select the SSH option on the left
Select Auth and then select the PPK private key file that you just generated
Click Browser to select the generated PPK file on your computer

Can log on after normal
The last thing you need to do is to log in with the password and log on with the key.
1. Modify/etc/ssh/sshd_config File
Modify Passwordauthentication Yes to Passwordauthentication no
2, restart sshd service/etc/init.d/ssh restart

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.