RHEL7.2 SSH非root用户无密码登录(2)

[hadoop@hadoop03 ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/hadoop/.ssh/id_rsa):
Created directory '/hadoop/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /hadoop/.ssh/id_rsa.
Your public key has been saved in /hadoop/.ssh/id_rsa.pub.
The key fingerprint is:
dc:c2:8d:14:b0:bf:64:a7:2f:41:44:34:1b:66:2b:b2 hadoop@hadoop03
The key's randomart image is:
+--[ RSA 2048]----+
|      .+O        |
|      +.*      |
|    . o.+        |
|    o *.+      |
|    E  .S +      |
|      o.=      |
|        o.      |
|        ..      |
|        ..      |
+-----------------+
[hadoop@hadoop03 ~]$ chmod 700 .ssh
[hadoop@hadoop03 ~]$ scp -rp ~/.ssh/id_rsa.pub hadoop@hadoop01:/hadoop/.ssh/id_rsa.pub.103
The authenticity of host 'hadoop01 (192.168.169.101)' can't be established.
ECDSA key fingerprint is 7a:41:d1:c6:30:98:21:51:40:b7:ac:13:a4:0d:05:5c.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'hadoop01,192.168.169.101' (ECDSA) to the list of known hosts.
hadoop@hadoop01's password:
id_rsa.pub 

192.168.169.101

[hadoop@hadoop01 ~]$ cat ~/.ssh/id_rsa.pub.102 >> ~/.ssh/authorized_keys
[hadoop@hadoop01 ~]$ cat ~/.ssh/id_rsa.pub.103 >> ~/.ssh/authorized_keys
[hadoop@hadoop01 ~]$ scp -rp ~/.ssh/authorized_keys hadoop@hadoop02:/hadoop/.ssh/
The authenticity of host 'hadoop02 (192.168.169.102)' can't be established.
ECDSA key fingerprint is f7:ef:fb:e5:7e:0f:59:40:63:23:99:9a:ca:e2:03:e8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'hadoop02,192.168.169.102' (ECDSA) to the list of known hosts.
hadoop@hadoop02's password:
authorized_keys                                                                                                                        100%  397    0.4KB/s  00:00   
[hadoop@hadoop01 ~]$ scp -rp ~/.ssh/authorized_keys hadoop@hadoop03:/hadoop/.ssh/
The authenticity of host 'hadoop03 (192.168.169.103)' can't be established.
ECDSA key fingerprint is 25:a7:16:1f:49:91:0f:ba:f8:ba:68:bb:1e:e0:1c:44.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'hadoop03,192.168.169.103' (ECDSA) to the list of known hosts.
hadoop@hadoop03's password:
authorized_keys                                                                                                                        100%  397    0.4KB/s  00:00   

6 验证

192.168.169.101

[hadoop@hadoop01 ~]$ ssh hadoop02
Last login: Sun Nov  5 13:42:56 2017 from 192.168.169.1
[hadoop@hadoop02 ~]$ exit
登出
Connection to hadoop02 closed.
[hadoop@hadoop01 ~]$ ssh hadoop03
Last login: Sun Nov  5 13:42:58 2017 from 192.168.169.1
[hadoop@hadoop03 ~]$

192.168.169.102

[hadoop@hadoop02 ~]$ ssh hadoop01
Last login: Sun Nov  5 13:44:08 2017 from 192.168.169.1
[hadoop@hadoop01 ~]$ exit
登出
Connection to hadoop01 closed.
[hadoop@hadoop02 ~]$ ssh hadoop03
The authenticity of host 'hadoop03 (192.168.169.103)' can't be established.
ECDSA key fingerprint is 25:a7:16:1f:49:91:0f:ba:f8:ba:68:bb:1e:e0:1c:44.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'hadoop03,192.168.169.103' (ECDSA) to the list of known hosts.
Last login: Sun Nov  5 13:51:57 2017 from hadoop01
[hadoop@hadoop03 ~]$ 

192.168.169.103

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/13285.html