Centos6 SSH Login Without Password

Source: Internet
Author: User

Generate a public key private key:

[Root @ client ~] # Ssh-keygen
Generating public/private RSA key pair.
Enter file in which to save the key (/root/. Ssh/id_rsa ):
Created directory '/root/. Ssh '.
Enter passphrase (empty for no passphrase ):
Enter same passphrase again:
Your identification has been saved in/root/. Ssh/id_rsa.
Your public key has been saved in/root/. Ssh/id_rsa.pub.
The key fingerprint is:
C6: 66: 93: 16: 73: 0b: BF: 46: 46: 28: 7d: A5: 38: A3: 4d: 6d root @ Client
The key's randomart image is:
+ -- [RSA 2048] ---- +
|. |
|. + O |
|. @ E |
| * &. |
|. S = |
| = +. |
| O |
|. |
|
+ ----------------- +

It is generated to ~ by default ~ /. Ssh:

[Root @ client ~] # Ls-L ~ /. SSH
Total 8
-RW -------. 1 Root 1675 Jul 27 :01 id_rsa
-RW-r --. 1 Root 406 Jul 27 :01 id_rsa.pub

Set permissions:

Chmod 700 ~ /. Ssh & chmod 600 ~ /. Ssh /*

Copy to server

[Root @ client ~] # SSH root @ server 'mkdir-P/root/. Ssh'
[Root @ client ~] # SCP/root/. Ssh/id_rsa.pub root @ server:/root/. Ssh/authorized_keys
[Root @ client ~] # SSH root @ server 'chmod 700/root/. Ssh & chmod 600/root/. Ssh /*'

Install necessary components

[Root @ client ~] # SSH root @ server 'yum install OpenSSH-clients'

The most important step is to modify the. Ssh permission if SELinux is enabled on the server. If SELinux is enabled on the server, you cannot log on even the above steps.

[Root @ client ~] # SSH root @ server 'restorecon-r-V/root/. Ssh'

Close the ticket ~

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.