CentOS 6.6 ssh key password-free Login

Source: Internet
Author: User

CentOS 6.6 ssh key password-free Login

Generate a public key and private key file --> import the content of the public key file to the local authentication file, and change the permission --> obtain the private key file for login Test

1. Generate public and private key files

[root@kvm~] #ssh-keygen-trsa

Press enter here, or enter a password (this password is used to calculate the ssh key, not the login password)

We can see that a. ssh directory is automatically created under the/root directory, and a pair of key files are generated under the/root/. ssh directory.

Id_rsa Private Key

Id_rsa.pub Public Key

2. Import the public key file to the local authentication file and change the permission.

[root@kvm. ssh ] # Cat/root/. ssh/id_rsa.pub>/root/. ssh/authorized_keys # Add the public key file content to the authentication file authorized_keys. [root@kvm. ssh ] # Chmod600/root/. ssh/authorized_keys # This step is very important to change the permission of the authentication file to 600. [root@kvm. ssh ] # Chmod700/root/. ssh/# change the permission of the/root/. ssh directory to 700

3. Copy the private key file to another machine for verification.

3.1 Use xshell for testing in Windows

3.2 use a Linux host for testing

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.