先说下事情的起因,手贱删掉了~/.ssh下的所有文件,包括authorized_keys,id_rsa,id_rsa.pub,以及known_hosts。其实,这四个文件本来就是没有的,id_rsa和id_rsa.pub是存储私钥和公钥的文件,通过命令生成。
Ssh-keygen
After all files have been deleted, then SSH Slave2 (remote host name) prompts the following message:
' 111.222.333.444 (111.222.333.444) ' can't be established. is F3:CF:(+):AE: 0b:c8:£ º 6f:Continue
After you confirm the carriage return, prompt as follows:
Host Key Verification failed
"Master key validation failed."
The solution is as follows, though not necessarily the best, but it does solve my problem.
Enter the following command on the master side:
" stricthostkeychecking No " [Email protected]
Hadoop is the master-side user name, and Slaver2 is the remote host name.
Then you can ssh Slave2 password login Slave2, execute the following command to first transfer master's public key to the Slave2 side, and then insert it into the Authorized_keys file (created when the file was inserted)
SCP ~/.ssh/id_rsa.pub [email protected]:/home/hadoop/~/id_rsa.pub >> ~/.ssh/authorized_keys
Then SSH Slave2, the result prompts the following information, still need to use the password to log in Slave2:
using the key.
The workaround is to execute the following command on the master side:
Ssh-add
The above method to solve the problem of no password login.
Reference:
Http://superuser.com/questions/125324/how-can-i-avoid-sshs-host-verification-for-known-hosts
Http://www.cnblogs.com/dlutxm/archive/2011/10/14/2212019.html
The principles of SSH refer to the following blog posts:
Http://www.ruanyifeng.com/blog/2011/12/ssh_remote_login.html
Stepping on the SSH pit