配置Linux两节点SSH密钥信任
生活随笔
收集整理的這篇文章主要介紹了
配置Linux两节点SSH密钥信任
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
首先感謝兄弟“瑞瑞”提供資料
1. 生成兩節點Oracle用戶SSH密鑰
Racnode1
[root@racnode1 ~]#su - oracle--------------------->【無.ssh目錄】
[oracle@racnode1 ~]$ll -a
total 32K
drwxr-xr-x 3 oracle oinstall 4.0K Jun 13 15:08 .kde
-rw-r--r-- 1 oracle oinstall 120 Jun 13 15:08 .gtkrc
-rw-r--r-- 1 oracle oinstall 124 Jun 13 15:08 .bashrc
-rw-r--r-- 1 oracle oinstall 191 Jun 13 15:08 .bash_profile
-rw-r--r-- 1 oracle oinstall 24 Jun 13 15:08 .bash_logout
drwxr-xr-x 3 root root 4.0K Jun 13 15:08 ..
drwx------ 3 oracle oinstall 4.0K Jun 13 15:08 .
[oracle@racnode1 ~]$ssh-keygen -t rsa--------------------->【一路回車】
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa):
Created directory '/home/oracle/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_rsa.
Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
8a:11:ad:48:03:3b:94:b4:bb:a9:fb:b4:df:e1:18:87 oracle@racnode1
[oracle@racnode1 ~]$ssh-keygen -t dsa--------------------->【一路回車】
Generating public/private dsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_dsa.
Your public key has been saved in /home/oracle/.ssh/id_dsa.pub.
The key fingerprint is:
7d:9e:de:16:85:71:36:09:d3:9e:03:d2:1e:fd:d6:1a oracle@racnode1
[oracle@racnode1 ~]$cat .ssh/*.pub > .ssh/authorized_keys
[oracle@racnode1 ~]$ll -a--------------------->【生成.ssh目錄,密碼鑰也已生成】
total 20K
-rw-r--r-- 1 oracle oinstall 225 Jun 13 15:30 id_rsa.pub
-rw------- 1 oracle oinstall 883 Jun 13 15:30 id_rsa
-rw-r--r-- 1 oracle oinstall 605 Jun 13 15:30 id_dsa.pub
-rw------- 1 oracle oinstall 668 Jun 13 15:30 id_dsa
-rw-r--r-- 1 oracle oinstall 830 Jun 13 15:35 authorized_keys
Racnode2
[root@racnode2 ~]#su - oracle--------------------->【無.ssh目錄】
[oracle@racnode1 ~]$ll -a
total 32K
drwxr-xr-x 3 oracle oinstall 4.0K Jun 13 15:08 .kde
-rw-r--r-- 1 oracle oinstall 120 Jun 13 15:08 .gtkrc
-rw-r--r-- 1 oracle oinstall 124 Jun 13 15:08 .bashrc
-rw-r--r-- 1 oracle oinstall 191 Jun 13 15:08 .bash_profile
-rw-r--r-- 1 oracle oinstall 24 Jun 13 15:08 .bash_logout
drwxr-xr-x 3 root root 4.0K Jun 13 15:08 ..
drwx------ 3 oracle oinstall 4.0K Jun 13 15:08 .
[oracle@racnode2 ~]$ssh-keygen -t rsa--------------------->【一路回車】
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa):
Created directory '/home/oracle/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_rsa.
Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
8a:11:ad:48:03:3b:94:b4:bb:a9:fb:b4:df:e1:18:87 oracle@racnode1
[oracle@racnode2 ~]$ssh-keygen -t dsa--------------------->【一路回車】
Generating public/private dsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_dsa.
Your public key has been saved in /home/oracle/.ssh/id_dsa.pub.
The key fingerprint is:
7d:9e:de:16:85:71:36:09:d3:9e:03:d2:1e:fd:d6:1a oracle@racnode1
[oracle@racnode2 ~]$cat .ssh/*.pub > .ssh/authorized_keys
[oracle@racnode2 ~]$ll .ssh/--------------------->【生成.ssh目錄,密碼鑰也已生成】
total 20K
-rw-r--r-- 1 oracle oinstall 225 Jun 13 15:34 id_rsa.pub
-rw------- 1 oracle oinstall 883 Jun 13 15:34 id_rsa
-rw-r--r-- 1 oracle oinstall 605 Jun 13 15:34 id_dsa.pub
-rw------- 1 oracle oinstall 672 Jun 13 15:34 id_dsa
-rw-r--r-- 1 oracle oinstall 830 Jun 13 15:36 authorized_keys
2. 配置兩節點Oracle用戶SSH無密碼登陸的信任關系
Racnode1
[oracle@racnode1 ~]$scp .ssh/authorized_keys oracle@10.10.10.102:/home/oracle/.ssh/keys_dbs
The authenticity of host '10.10.10.102 (10.10.10.102)' can't be established.
RSA key fingerprint is 3c:84:f4:d9:d8:88:2d:9c:99:47:6a:21:1c:93:95:8d.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.10.10.102' (RSA) to the list of known hosts.
oracle@10.10.10.102's password:RacNode2節點Oracle用戶的密碼
authorized_keys 100%? 830???? 0.8KB/s?? 00:00
Racnode2
[oracle@racnode2 ~]$cat .ssh/keys_dbs >> .ssh/authorized_keys
[oracle@racnode2 ~]$scp .ssh/authorized_keys oracle@10.10.10.101:/home/oracle/.ssh/
The authenticity of host '10.10.10.101 (10.10.10.101)' can't be established.
RSA key fingerprint is 3c:84:f4:d9:d8:88:2d:9c:99:47:6a:21:1c:93:95:8d.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.10.10.101' (RSA) to the list of known hosts.
oracle@10.10.10.101's password: RacNode1節點Oracle用戶的密碼
authorized_keys 100% 830 0.8KB/s 00:00
3. 配置兩節點Oracle用戶信任關系的測試
Racnode1
[oracle@racnode1 ~]$ssh racnode1
The authenticity of host 'racnode1 (10.10.10.101)' can't be established.
RSA key fingerprint is 3c:84:f4:d9:d8:88:2d:9c:99:47:6a:21:1c:93:95:8d.
Are you sure you want to continue connecting (yes/no)? yes
Last login: Mon Jun 13 15:44:03 2011 from racnode1
[oracle@racnode1 ~]$exit
logout
Connection to racnode1 closed.
[oracle@racnode1 ~]$ssh racnode2
The authenticity of host 'racnode2 (10.10.10.102)' can't be established.
RSA key fingerprint is 3c:84:f4:d9:d8:88:2d:9c:99:47:6a:21:1c:93:95:8d.
Are you sure you want to continue connecting (yes/no)? yes
Last login: Mon Jun 13 15:44:03 2011 from racnode1
[oracle@racnode2 ~]$exit
logout
Connection to racnode1 closed.
[oracle@racnode1 ~/.ssh]$ssh racnode1-priv
The authenticity of host 'racnode1-priv (192.168.0.101)' can't be established.
RSA key fingerprint is 3c:84:f4:d9:d8:88:2d:9c:99:47:6a:21:1c:93:95:8d.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'racnode1-priv,192.168.0.101' (RSA) to the list of known hosts.
Last login: Mon Jun 13 15:46:07 2011 from racnode1
[oracle@racnode1 ~]$exit
logout
Connection to racnode1-priv closed.
[oracle@racnode1 ~/.ssh]$ssh racnode2-priv
The authenticity of host 'racnode2-priv (192.168.0.102)' can't be established.
RSA key fingerprint is 3c:84:f4:d9:d8:88:2d:9c:99:47:6a:21:1c:93:95:8d.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'racnode2-priv,192.168.0.102' (RSA) to the list of known hosts.
Last login: Mon Jun 13 15:46:59 2011 from racnode1
[oracle@racnode2 ~]$exit
logout
Connection to racnode2-priv closed.
Racnode2
[oracle@racnode2 ~]$ssh racnode1
The authenticity of host 'racnode1 (10.10.10.101)' can't be established.
RSA key fingerprint is 3c:84:f4:d9:d8:88:2d:9c:99:47:6a:21:1c:93:95:8d.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'racnode1' (RSA) to the list of known hosts.
Last login: Mon Jun 13 15:49:14 2011 from racnode1-priv
[oracle@racnode1 ~]$exit
logout
Connection to racnode1 closed.
[oracle@racnode2 ~]$ssh racnode2
The authenticity of host 'racnode2 (10.10.10.102)' can't be established.
RSA key fingerprint is 3c:84:f4:d9:d8:88:2d:9c:99:47:6a:21:1c:93:95:8d.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'racnode2,10.10.10.102' (RSA) to the list of known hosts.
Last login: Mon Jun 13 15:49:28 2011 from racnode1-priv
[oracle@racnode2 ~]$exit
logout
Connection to racnode2 closed.
[oracle@racnode2 ~]$ssh racnode1-priv
The authenticity of host 'racnode1-priv (192.168.0.101)' can't be established.
RSA key fingerprint is 3c:84:f4:d9:d8:88:2d:9c:99:47:6a:21:1c:93:95:8d.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'racnode1-priv,192.168.0.101' (RSA) to the list of known hosts.
Last login: Mon Jun 13 15:49:56 2011 from racnode2
[oracle@racnode1 ~]$exit
logout
Connection to racnode1-priv closed.
[oracle@racnode2 ~]$ssh racnode2-priv
The authenticity of host 'racnode2-priv (192.168.0.102)' can't be established.
RSA key fingerprint is 3c:84:f4:d9:d8:88:2d:9c:99:47:6a:21:1c:93:95:8d.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'racnode2-priv,192.168.0.102' (RSA) to the list of known hosts.
Last login: Mon Jun 13 15:50:16 2011 from racnode2
[oracle@racnode2 ~]$exit
logout
Connection to racnode2-priv closed.
轉載于:https://www.cnblogs.com/qq78292959/archive/2011/06/15/2081696.html
總結
以上是生活随笔為你收集整理的配置Linux两节点SSH密钥信任的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 推荐一个网站--------皮皮书屋,虽
- 下一篇: 雪花病毒分析报告