Stepping on the SSH pit

Source: Internet
Author: User

先说下事情的起因,手贱删掉了~/.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

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.