Connect two hosts through SSH-keygen

Source: Internet
Author: User

If you skip between servers, it will be troublesome if you do not connect the channel, even if you can remember the password you have. I used it a long time ago. I used it a few days ago. I suddenly forgot how to use it. I wrote it down today so that I would not forget to find a method again.

Machine 1: dwapp @ pttest1

Machine 2: gpadmin1 @ hadoop1

 

First try to jump from 1 to 2

Dwapp @ pttest1:/home/dwapp/. Ssh> SSH gpadmin1 @ hadoop1
Gpadmin1 @ hadoop1's password:

Dwapp @ pttest1:/home/dwapp/. Ssh>

Prompt to enter the password, CTRL + C to end. Since we want to jump from 1 to 2, we must first establish trust between them. How can we establish it? You think, what you want to achieve is to jump from 1 without entering a password to 2, so why do you trust 2? You have to ensure that people can jump unconditionally.

There is a. Ssh folder under the Home Directory and CD to see what is there

Dwapp @ pttest1:/home/dwapp/. Ssh> ls
Authorized_keys

 

Execute the following command ssh-keygen-t dsa. Press enter to generate two files.

Dwapp @ pttest1:/home/dwapp/. Ssh> ls
Authorized_keys id_dsa id_dsa.pub

 

Append the content in id_dsa.pub to the authorized_keys file of Machine 2, and then try to jump from 1 to 2.

Dwapp @ pttest1:/home/dwapp/. Ssh> SSH gpadmin1 @ hadoop1
Last login: Tue Mar 22 21:59:04 2011 from 10.22.13.107
Authorized uses only. All activity may be monitored and reported.
[Gpadmin1 @ hadoop1 ~] $

###############

I tried to jump several times in the new environment today and still needed a password. I searched the internet and found a place to be ignored.

Set authorized_keys Permissions
$ Chmod 600 authorized_keys
Set. Ssh Directory Permissions
$ Chmod 700-R. SSH

Attached to a previous post http://nickkathy.javaeye.com/blog/653921

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.