zoukankan      html  css  js  c++  java
  • 配置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.



  • 相关阅读:
    mac 安装ROS2
    193 最长有效括号
    个人笔记
    个人笔记
    个人笔记-大佬主页
    笔记-吴恩达老师机器学习及深度学习
    个人笔记
    转载-资源链接
    枚举类型
    333333333333333333333333
  • 原文地址:https://www.cnblogs.com/qq78292959/p/2081696.html
Copyright © 2011-2022 走看看