OpenSSH RSA 单向无密码认证

系统CentOS6.5


ssh-keygenopenssh的一个功能,如果不能执行该命令,需要查看是否已经安装openssh

 

目的:实现10.1.1.110.1.1.2(相反)单向无密码认证

 

10.1.1.1上生成秘钥

[root@localhost~]# ssh-keygen -t rsa -C"10.1.1.1"

Generatingpublic/private rsa key pair.

Enter file in whichto save the key (/root/.ssh/id_rsa):

Created directory'/root/.ssh'.

Enter passphrase(empty for no passphrase):

Enter samepassphrase again:

Your identificationhas been saved in /root/.ssh/id_rsa.

Your public key hasbeen saved in /root/.ssh/id_rsa.pub.

The key fingerprintis:

34:d0:4d:25:42:8d:70:79:02:34:32:91:60:3e:d5:5aroot@localhost.localdomain

The key's randomartimage is:

+--[ RSA 2048]----+

|  o.==*=+*o..   |

| o ..oE+=.+.     |

|  o o  oo       |

|   ..  ..       |

|        S       |

|                 |

|                 |

|                 |

|                 |

+-----------------+

 

 

生成一个公钥id_rsa.pub和一个私钥id_rsa

#cd /root/.ssh

[root@localhost.ssh]# ll

总用量 8

-rw------- 1 root root 1675 9   6 17:38 id_rsa

-rw-r--r-- 1 root root  408 9   6 17:38 id_rsa.pub

 

10.1.1.1生成的id_rsa.pub拷贝到10.1.1.2

# scp/root/.ssh/id_rsa.pub root@10.1.1.2:/

 

10.1.1.2上建立root/.ssh文件夹,并创建authorized_keys文件

#mkdir root/.ssh

#cd root/.ssh/

#cp /id_rsa.pubauthorized_keys

#chmod 400authorized_keys

#rm /id_rsa.pub

 

现在10.1.1.1 ssh10.1.1.2 将不需要密码

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值