基于密钥的身份验证(Linux-Linux)

A主机:

1、生成密钥对

[root@servera ~]# ssh-keygen

查看公钥

 注:id_rsa为私钥(证书),id_rsa.pub为公钥

2、注册公钥到服务器

[root@servera ~]# ssh-copy-id [email protected]

查看.ssh

 

3、使用密钥连接服务器

# 登录另一台服务器,无需密码
[root@servera ~]# ssh [email protected]

B主机:

1、生成密钥对

[root@localhost ~]# ssh-keygen

 2、注册公钥到服务器

[root@localhost ~]# ssh-copy-id [email protected]

3、使用密钥连接服务器

[root@localhost ~]# ssh [email protected]

猜你喜欢

转载自blog.csdn.net/hotslow/article/details/140560403