Set ssh password-less login for CentOS

Source: Internet
Author: User
Ssh configuration host A: 10.0.5.199 host B: 10.0.5.198 you need to configure host A to log on to host A without A password. host B first makes sure that the firewalls of all hosts are disabled. Run the following command on host A: 1. $ cd ~ /. Ssh2. $ ssh-keygen-trsa ------------------ and keep

Ssh configuration

Host A: 10.0.5.199

Host B: 10.0.5.198

You need to configure host A to log on to host A and host B without A password.

First, make sure that the firewall of all hosts is disabled.

Run the following command on host:

1. $ cd ~ /. Ssh

2. $ ssh-keygen-t rsa ------------------ press the Enter key until the generated key is saved in the. ssh/id_rsa file according to the default options.

3. $ cp id_rsa.pub authorized_keys

After this step, you can log on to the local machine without a password, that is, ssh localhost, without entering the password.

4. $ scp authorized_keys summer@10.0.5.198:/home/summer/. ssh ------ copy the generated authorized_keys file to host B.

5. $ chmod 600 authorized_keys

Go to the. ssh directory of host B and change the permission of the authorized_keys file.

(4 and 5 can merge one step, execute: $ ssh-copy-id-I summer@10.0.5.198)

 

After completing the preceding steps, you can initiate an ssh connection from the host A to the host A and B. you only need to enter the password for the first login and will not need it later.

 

Possible problems:

1. during ssh login, the following error occurs: "Agent admitted failure to sign using the key".

Run: $ ssh-add

Forcibly add the private key.

2. if no error message is displayed, you can enter A password to log on, but you cannot log on without A password on the connected host (for example, if A initiates an ssh connection to B, it will be on B) perform the following steps:

$ Chmod o-w ~ /

    $chmod 700 ~/.ssh

$ Chmod 600 ~ /. Ssh/authorized_keys

3. if you still cannot log on without a password after step 1, try the following:

$ Ps-Af | grep agent

Check whether the ssh proxy is enabled. If enabled, kill the proxy and run the following command to re-open an ssh proxy. if not, run the following command:

$ Ssh-agent

If the problem persists, run the following command to restart the ssh service.

$ Sudo service sshd restart

4. "cocould not open a connection to your authenticationh agent" prompt when executing ssh-add, but failed

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.