Transferred from: http://haitao.iteye.com/blog/1744272
SSH configuration
Host a:10.0.5.199
Host b:10.0.5.198
Need to configure host a without password logon host A, Host B
First make sure that all hosts ' firewalls are turned off.
On host A, perform the following:
1. $CD ~/.ssh
2. $ssh-keygen-t RSA--------------------and then press ENTER, 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 is complete, you can normally log on to the machine without a password, that is, ssh localhost, without entering a password.
4. $SCP Authorized_keys [email protected]:/home/summer/.ssh------Copy the Authorized_keys file that was just generated to host B.
5. $chmod Authorized_keys
Enter the. SSH directory of Host B to change the license permissions for the Authorized_keys file.
(4 and 5 can be synthesized one step, execute: $ssh-copy-id-i [email protected] )
Under normal circumstances, after the completion of the above steps, from host a machine to host A, Host B is the machine to initiate an SSH connection, only the first time you need to enter the password, then do not need.
Problems you may encounter:
1. When SSH is logged in, it appears: Agent admitted failure to sign using the key.
Execution: $ssh-add
2. If there is no error prompt, you can login with the password, but it is not possible to login without password, on the connected host (such as a to B to initiate an SSH connection, on B) perform the following steps:
$chmod o-w ~/
$chmod 700 ~/.ssh
$chmod 600 ~/.ssh/authorized_keys
3.如果执行了第2步,还是不能无密码登录,再试试下面几个
$ps-af | grep agent
Check whether the SSH proxy is turned on, if it is on, kill the agent, and then execute the following, reopen an SSH proxy, if not open, directly execute the following:
$ssh-agent
Or not, do the following, restart the SSH service
$sudo Service sshd Restart
Note: the. SSH directory in the $home directory of the Linux system is owned by the user, and the permissions must be 700 (only the user has full access); The authorization file "Authorized_keys" under the SSH directory is owned by the user, and the permissions must be 644. SSH Password-free login under Linux
SSH Password-free login under Linux