Set password-less ssh in linux
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