Linux互通SSH免密码访问

共三步:

一、生成一对密匙

二、发送密匙到其他机器上

比如有4台Linux机器需要互通SSH,则每台机器上需要执行下面红色指令3次(针对其余3台机器,指令中IP改成其他3台机器IP)。password处输入root用户密码

三、操作完毕,登陆检查。   


一、以root用户执行下述命令:

[root@localhost .ssh]# /usr/bin/ssh-keygen -t rsa   

Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
30:f6:d7:2a:ac:56:eb:3f:fa:40:25:8d:90:96:68:cb root@localhost.localdomain

该命令将在用户的主目录/.ssh目录下面产生一对密钥
一般采用的ssh的rsa密钥: 
id_rsa     私钥
id_rsa.pub 公钥

二、[root@localhost .ssh]# scp /root/.ssh/id_rsa.pub root@172.16.142.5:/root/.ssh/authorized_keys

The authenticity of host '172.16.142.5 (172.16.142.5)' can't be established.
RSA key fingerprint is 4b:a5:74:fb:2e:08:60:af:fa:76:d4:b0:26:4c:13:75.
Are you sure you want to continue connecting (yes/no)?yes
Warning: Permanently added '172.16.142.5' (RSA) to the list of known hosts.
root@172.16.142.5's password:

id_rsa.pub  

三、[root@localhost .ssh]# ssh 172.16.142.5
root@172.16.142.5's password:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值