当前位置: 首页 > news >正文

三台ubuntu22相互免密登录最快

环境

  • 主机1: node1 (IP: 192.168.1.10)

  • 主机2: node2 (IP: 192.168.1.11)

  • 主机3: node3 (IP: 192.168.1.12) 

步骤 1: 配置主机名解析(在所有节点上)

编辑 /etc/hosts 文件:

bash
sudo nano /etc/hosts

添加以下内容:

192.168.1.10 node1
192.168.1.11 node2
192.168.1.12 node3

· 验证解析:

bash
ping -c 3 node1
ping -c 3 node2
ping -c 3 node3

步骤 2: 生成 SSH 密钥对(在所有节点上)

bash
# 生成 RSA 密钥(一路回车即可)
ssh-keygen -t rsa -b 4096# 或者生成 ED25519 密钥(更安全)
ssh-keygen -t ed25519

密钥将保存在:~/.ssh/id_rsa(私钥)和 ~/.ssh/id_rsa.pub(公钥)

步骤 3: 创建授权密钥文件

在 node1 上执行:

bash
ssh-copy-id node1
ssh-copy-id node2
ssh-copy-id node3

在 node2 上执行:

bash
ssh-copy-id node1
ssh-copy-id node2  
ssh-copy-id node3

在 node3 上执行:

bash
ssh-copy-id node1
ssh-copy-id node2
ssh-copy-id node3

步骤 4: 设置正确的权限

在所有节点上执行:

bash
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
chmod 600 ~/.ssh/id_rsa
chmod 644 ~/.ssh/id_rsa.pub
chmod 644 ~/.ssh/known_hosts

步骤 5: 测试免密登录

ssh node1
ssh node2
ssh node3

以上在本地测试完成,但助于ds完成攻略。
 
http://www.wxhsa.cn/company.asp?id=6777

相关文章:

  • 状态机
  • 设计模式
  • Rhinoceros 8.23.25251.13001 犀牛3D建模
  • Git 常用操作指南
  • 《深入理解计算机系统》计算机系统漫游(一) - Invinc
  • 从几何分离到语义理解:深度解析3D点云分割与语义分割的本质区别
  • 欧拉筛(线性筛)算法分析
  • 2021年安徽省大数据与人工智能应用竞赛 大数据(网络赛)-高职组赛题
  • 一些写了和没写的数学!
  • 【光照】[自发光Emission]以UnityURP为例
  • mybatis-plus初体验,解决报错Invalid value type for attribute factoryBeanObjectType: java.lang.String
  • 04_UDP协议
  • 从0到1搭建数据分析自动化程序链,AI应用架构师的实战指南
  • IOS App技术支持网址(URL)
  • Alexandresku设计的loki小对象内存分配器
  • C++ 内存管理
  • 浅谈制氢电源及英飞凌解决方案
  • 微算法科技(NASDAQ:MLGO)研究分布式量子计算,释放量子计算潜能
  • AI 重塑招聘三角:Moka 招聘智能体如何实现 HR、候选人与企业的三方共赢
  • Flash Attention原理
  • MSMQ 跨服务器读写队列的“消息队列系统的访问被拒绝”的解决方案
  • opencv学习记录1
  • kylin V10SP3安装mysql5.7.42
  • MATLAB 仿真无线传感器网络(WSN)三大经典场景
  • 9.05 DP 专题
  • Linux时间同步---NTP时间同步方案
  • java预习
  • B/S体系结构风格
  • The 2024 CCPC Online Contest 7/12 L/B/K/D/J/E/C
  • 在joule里面使用agent 功能