zoukankan      html  css  js  c++  java
  • 配置SSH互信

    配置3台服务器SSH 互信:

    1)打开ssh配置文件,启用以下选项

    RSAAuthentication yes     #允许RSA认证

    PubkeyAuthentication yes  #允许公钥认证

    AuthorizedKeysFile      .ssh/authorized_keys   #公钥存放地址

    PermitRootLogin yes    #如果要以root身份ssh互信登陆

    2)# 生成公钥并分发其他服务器

    ssh-keygen -t rsa   连续回车

     

     

    2)#将公钥添加到认证文件,并将认证文件整合在一个文件。

    [root@pxc3 ~]# cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

    #设置authorized_keys的访问权限

    [root@pxc3 ~]#chmod 600 ~/.ssh/authorized_keys

    [root@pxc3 ~]# ssh 192.168.56.121  cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
    [root@pxc3 ~]# ssh 192.168.56.130  cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys

    3)# 分发整合后的公钥文件到其它节点

    scp ~/.ssh/authorized_keys 192.168.56.121:~/.ssh/
    scp ~/.ssh/authorized_keys 192.168.56.130:~/.ssh/

    [root@pxc3 ~]# scp ~/.ssh/authorized_keys 192.168.56.121:~/.ssh/

    root@192.168.56.121's password:

    authorized_keys                                                                                                                               100% 1173     1.2KB/s   00:00    

    [root@pxc3 ~]# scp ~/.ssh/authorized_keys 192.168.56.130:~/.ssh/

    root@192.168.56.130's password:

    authorized_keys                                                                                                                                           100% 1173     1.2KB/s   00:00    

    [root@pxc3 ~]# 

    4)# 测试时,第一次,需要输入密码,之后就不需要输入密码了。

    122 pxc3 测试其他2个节点ssh 互信连通性

    [root@pxc3 ~]# ssh  192.168.56.130

    [root@pxc2 ~]# ssh  192.168.56.121

    121 pxc1 测试其他2个节点ssh 互信连通性

    [root@pxc1 ~]# ssh 192.168.56.122

    [root@pxc3 ~]# ssh 192.168.56.130

    130 pxc2 测试其他2个节点ssh 互信连通性

    [root@pxc2 ~]# ssh 192.168.56.121

    [root@pxc1 ~]# ssh 192.168.56.122

  • 相关阅读:
    HTTP传递数据的几种方法
    Python LOGGING使用方法
    EntityFramework Code First 添加唯一键
    The model backing the <Database> context has changed since the database was created.
    No connection string named '***' could be found in the application config file
    Generating a new ASP.NET session in the current HTTPContext
    add .json handler support in IIS 7
    Reset Entity-Framework Migrations
    Changing the type of a property with EF Code First
    命令行模式下 MYSQL导入导出.sql文件的方法
  • 原文地址:https://www.cnblogs.com/vzhangxk/p/13182828.html
Copyright © 2011-2022 走看看