SSH configuration
Host a:10.0.5.199
Host b:10.0.5.198
Need to configure host a without password login host A, Host B
Make sure that the firewall for all hosts is turned off first.
On host A, perform the following:
1. $CD ~/.ssh
2. $ssh-keygen-t RSA------------------and press ENTER continuously, the generated private key is saved in the. ssh/id_rsa file with the default option, and the generated public key is saved in. ssh/id_rsa.pub.
3. $CP Id_rsa.pub Authorized_keys
After this step is completed, normally you can log on without a password, that is, ssh localhost, do not need to enter a password.
4. $SCP Authorized_keys summer@10.0.5.198:/home/summer/.ssh------To copy a copy of the Authorized_keys document that was just produced to Host B.
5. $chmod Authorized_keys
Enter the. SSH (chmod. ssh) directory of Host B to change the permissions for Authorized_keys files.
(4 and 5 can be synthesized one step, execute: $ssh-copy-id-i summer@10.0.5.198)
Normally, after the completion of the above steps, from host a machine to host A, Host B machine to initiate an SSH connection, only the first time you need to enter a password, you do not need.
Problems that you may encounter:
1. SSH login, appears: "Agent admitted failure to sign using the key."
Execution: $ssh-add forcibly add the private key in.
2. If you do not have any error prompts, you can enter the password to log in, but you cannot login without password, on the connected host (such as A to B SSH connection, then on B) to perform the following steps:
$chmod o-w ~/
$chmod ~/.ssh
$chmod ~/.ssh/authorized_keys
3. If the 2nd step is performed, you cannot log in without a password, and then try some of the following
$ps-af | grep agent
Check that the SSH agent is turned on and, if it is, kill the agent, and then perform the following to reopen an SSH agent, if it is not turned on, execute the following directly:
$ssh-agent
Or not, do the following, restart the SSH service
$sudo Service sshd Restart
4. Failure to prompt "could not open a connection to your AUTHENTICATIONH agent" when executing ssh-add
Execution: Ssh-agent bash
This column more highlights: http://www.bianceng.cnhttp://www.bianceng.cn/OS/Linux/