About SSH No key mutual login encountered problems

Source: Internet
Author: User
Tags ssh

The main operation of this writing is very detailed: http://space.itpub.net/26686207/viewspace-742502, excerpt as follows:

Setting up SSH for H1 H2 H4

H4

[Grid@h4 ~]$ ssh-keygen-t RSA uses RSA encryption algorithm to generate key pair

Generating public/private RSA key pair. A public key and a private key

Enter file in which to save the key (/HOME/GRID/.SSH/ID_RSA):

Created directory '/home/grid/.ssh '.

Enter passphrase (empty for no passphrase):

Enter same Passphrase again:

Your identification has been saved In/home/grid/.ssh/id_rsa. This is the private key.

Your public key has been saved in/home/grid/.ssh/id_rsa.pub. This is the public key.

The key fingerprint is:

50:29:8A:78:AC:0E:A1:72:10:2D:01:66:77:F0:7E:C1 Grid@h4

The key ' s Randomart image is:rsa random graph

+--[RSA 2048]----+

|+= O..      .. |

|= o O.. |

| = . O.E |

|+ + O.. |

|. =  . . S |

|= .         . |

|+. |

| . |

| |

+-----------------+

[Grid@h4 ~]$ Ll–lrta as long as the home directory is generated. SSH hidden directory even if it succeeds

Total dosage

-rw-r--r--. 1 grid Hadoop 500 January. Emacs

Drwxr-xr-x. 2 grid Hadoop 4096 November. gnome2

-rw-r--r--. 1 grid Hadoop 124 May BASHRC

-rw-r--r--. 1 grid Hadoop 176 May Bash_profile

-rw-r--r--. 1 grid Hadoop 18 May bash_logout

Drwxr-xr-x. 4 root root 4096 September 1 21:14..

DRWX------. 5 grid Hadoop 4096 September 1 21:34.

DRWX------. 2 grid Hadoop 4096 September 1 21:34. SSH

Drwxr-xr-x. 4 grid Hadoop 4096 September 2. Mozilla

[Grid@h4 ~]$ CD. SSH

[Grid@h4. ssh]$ ll

Total Dosage 8

-RW-------. 1 grid Hadoop 1675 September 1 21:34 id_rsa

-rw-r--r--. 1 grid Hadoop 389 September 1 21:34 id_rsa.pub

[Grid@h4. ssh]$ CP id_rsa.pub Authorized_keys Generate authorization file

[Grid@h4. ssh]$ Cat Authorized_keys Open Authorized_keys View the public key inside

Ssh-rsa aaaab3nzac1yc2eaaaabiwaaaqear6+d01kkqemurkyakulv3su+9ru+jj6snjmlydxfq38ogbsjbwcskvl/i9ds7ve5g7cop+ cmzgtryj1ns+elgf0g3/uhtserad4qdwxvlzgujyuxijkm+ni3ssdwlihzsnngh4gzekx3hqah/7s+rlozsbpi// w9hyfo6vexdo7n2lkvuxnw2z/h7juypmeqiaoiwaelk7ajxhjjaejkzh/ ccguex4ublrxqce5zjbnsfapod2bact1w80a7mrgzan3cvcquqpzmpdj750negxmtai+qrmpdlsx2zxtbari4opsvmbiqpy84pj/ h9m5wptq3hg/1xixv4gyqwlsxzw== Grid@h4

With this public key and with the private key, we'll be able to password-free login.

H2

[Grid@h2 ~]$ ssh-keygens-t RSA

-bash:ssh-keygens:command not found

[Grid@h2 ~]$ ssh-keygen-t RSA

Generating public/private RSA key pair.

Enter file in which to save the key (/HOME/GRID/.SSH/ID_RSA):

Created directory '/home/grid/.ssh '.

Enter passphrase (empty for no passphrase):

Enter same Passphrase again:

Your identification has been saved In/home/grid/.ssh/id_rsa.

Your public key has been saved in/home/grid/.ssh/id_rsa.pub.

The key fingerprint is:

14:55:b9:d1:4a:60:a1:5c:47:37:30:49:09:aa:30:3d GRID@H2

The key ' s Randomart image is:rsa random graph each is not the same

+--[RSA 2048]----+

| .. Bbb*o |

| . . *. *o. |

| o E =. +  |

| O + O |

| . S |

| |

| |

| |

| |

+-----------------+

[Grid@h2 ~]$ CD. SSH

[GRID@H2. ssh]$ ll

Total Dosage 12

-RW-------. 1 grid Hadoop 1675 September 1 21:59 Id_rsa also generated private keys and public keys

-rw-r--r--. 1 grid Hadoop 389 September 1 21:59 id_rsa.pub

H4

[Grid@h4. ssh]$ SCP Authorized_keys h2:/home/grid/.ssh/H4 's authorization file->h2

H2

[GRID@H2. ssh]$ ll

Total Dosage 12

-rw-r--r--. 1 grid Hadoop 778 September 1 22:02 authorized_keys

-RW-------. 1 grid Hadoop 1675 September 1 21:59 id_rsa

-rw-r--r--. 1 grid Hadoop 389 September 1 21:59 id_rsa.pub

[Grid@h2. ssh]$ Cat Authorized_keys

Ssh-rsa aaaab3nzac1yc2eaaaabiwaaaqear6+d01kkqemurkyakulv3su+9ru+jj6snjmlydxfq38ogbsjbwcskvl/i9ds7ve5g7cop+ cmzgtryj1ns+elgf0g3/uhtserad4qdwxvlzgujyuxijkm+ni3ssdwlihzsnngh4gzekx3hqah/7s+rlozsbpi// w9hyfo6vexdo7n2lkvuxnw2z/h7juypmeqiaoiwaelk7ajxhjjaejkzh/ ccguex4ublrxqce5zjbnsfapod2bact1w80a7mrgzan3cvcquqpzmpdj750negxmtai+qrmpdlsx2zxtbari4opsvmbiqpy84pj/ h9m5wptq3hg/1xixv4gyqwlsxzw== Grid@h4

Ssh-rsa aaaab3nzac1yc2eaaaabiwaaaqea5ikgfogkh3d8byr4vkknaetzkxcbbzbn6pfd0n3h82/ 1f9pwett4cegqzbssyvq2nbc6duy2nbdd9j5diwqens/fajdwccdijjeymo5+ o4ocpabx6ovm0r9nsukyu7bxehjap3zumcc1uvgw5asosrml7epcze+rnt5d5ldz+vokh0ngty2/ cst8qxhmedfzfbqsehipf5lh4a6osorhtfqbdn4apvf5s7cm5/ngpiyhu+ Kbhbz96pncxkjuowj69a7kx4agqyjoyc0t9o6yfjfvy3l1a7n2aj6jp4smv0gaohgzirbnxwofk6skuyf10yixvnlgzkhtyk9gs9hjjw

See now the authorization file already has the public key of H4 and H2, the difference H1

H1

[Grid@h1 ~]$ ssh-keygen-t RSA

Generating public/private RSA key pair.

Enter file in which to save the key (/HOME/GRID//.SSH/ID_RSA):

Enter passphrase (empty for no passphrase):

Enter same Passphrase again:

Your identification has been saved In/home/grid//.ssh/id_rsa.

Your public key has been saved in/home/grid//.ssh/id_rsa.pub.

The key fingerprint is:

B6:4E:A6:05:D3:37:E7:3D:CA:44:7B:CF:2C:D2:5B:A4 GRID@H1

The key ' s Randomart image is:

+--[RSA 2048]----+

| |

| |

| |

|        . |

| o S o O. |

| + o = o O |

| =  +. E. |

| * o.oo* |

| .  . O.. o+|

+-----------------+

H2

[GRID@H2. ssh]$ SCP Authorized_keys h1:/home/grid/.ssh/

H1

[GRID@H1. ssh]$ ll

Total Dosage 12

-rw-r--r--. 1 grid Hadoop 778 September 1 22:12 authorized_keys

-RW-------. 1 grid Hadoop 1675 September 1 22:12 id_rsa

-rw-r--r--. 1 grid Hadoop 389 September 1 22:12 id_rsa.pub

[Grid@h1. ssh]$ cat id_rsa.pub >> authorized_keys Copy the public key of three nodes to a file

[Grid@h1. ssh]$ Cat Authorized_keys

Ssh-rsa aaaab3nzac1yc2eaaaabiwaaaqear6+d01kkqemurkyakulv3su+9ru+jj6snjmlydxfq38ogbsjbwcskvl/i9ds7ve5g7cop+ cmzgtryj1ns+elgf0g3/uhtserad4qdwxvlzgujyuxijkm+ni3ssdwlihzsnngh4gzekx3hqah/7s+rlozsbpi// w9hyfo6vexdo7n2lkvuxnw2z/h7juypmeqiaoiwaelk7ajxhjjaejkzh/ ccguex4ublrxqce5zjbnsfapod2bact1w80a7mrgzan3cvcquqpzmpdj750negxmtai+qrmpdlsx2zxtbari4opsvmbiqpy84pj/ h9m5wptq3hg/1xixv4gyqwlsxzw== Grid@h4

Ssh-rsa aaaab3nzac1yc2eaaaabiwaaaqea5ikgfogkh3d8byr4vkknaetzkxcbbzbn6pfd0n3h82/ 1f9pwett4cegqzbssyvq2nbc6duy2nbdd9j5diwqens/fajdwccdijjeymo5+ o4ocpabx6ovm0r9nsukyu7bxehjap3zumcc1uvgw5asosrml7epcze+rnt5d5ldz+vokh0ngty2/ cst8qxhmedfzfbqsehipf5lh4a6osorhtfqbdn4apvf5s7cm5/ngpiyhu+ kbhbz96pncxkjuowj69a7kx4agqyjoyc0t9o6yfjfvy3l1a7n2aj6jp4smv0gaohgzirbnxwofk6skuyf10yixvnlgzkhtyk9gs9hjjw== Grid@h2

Ssh-rsa aaaab3nzac1yc2eaaaabiwaaaqea5v1lyss14a8awfektk/abgkhflmx/xzx/xtxvuqjl8nktqvlq37+ Xlyqvtfrcjsja70diqb3trwbp3k5exnxp3eor6eghsi0b6d8owsg0bcdhxhghu8rx8wb4dh9uov1upl5besaphjuemquqaqzlagqrnxbrkix8czdiegmnokny is49q9msnzawqo3luqfru7mqvau9uzqkxotrnzhqh0tgjj3sq6o6nsca7w//xmb0jgobvqafcdjqdn/ z1koq7e5wnhva8ynf9gof7cmdppug7ibw1rz9cka+igi1khhavs5h7xcm64nugfc87aqe9nz0yss3kh8pt5h6zlxfw== GRID@H1

[GRID@H1. ssh]$ SCP Authorized_keys h2:/home/grid/.ssh/passed to H2

[GRID@H1. ssh]$ SCP Authorized_keys h4:/home/grid/.ssh/passed to H4


Follow-up meets two questions:

Solution Agent admitted failure to sign using the key problem with SSH

Configuring SSH

Before installing SSH on this machine, you can install it via sudo apt-get install SSH or via new. If it is not configured, logging on to the local computer or the remote host requires a password for that host. Below is a password-free login configuration:

  Very simple, execute ssh-keygen-t RSA command, all the way to enter the line, in the. SSH folder generated 2 files, a public key and a private key file,  id_rsa  id_rsa.pub , Then execute cp  ~/.ssh/id_rsa

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.