ssh—免密登录
实验环境
Linux系统版本:redhat8.2
Windows系统:windows10
前提条件
确保防火墙 和 SELinux为开启状态
systemctl start firewalld
setenforce 1
基本逻辑
谁创建的证书,谁就掌握私钥,然后将公钥传递给对方。
私钥不传递,公钥传递。
登录方(windows)使用私钥登录。
被登录方(redhat)需要将公钥覆盖给 authorized_keys
PS:以上内容属于个人总结,如有不对,望指正! 感谢!
拓展知识
公钥加密,私钥解密: 最常用作对数据进行加密,这些数据不愿被别人看到,只能由秘钥持有者看到。
私钥加密,公钥解密: 是为了保证数据是由秘钥持有者发出的,保证操作不是其他人发起的。
方法一:redhat创建证书—xshell登录redhat:
一、创建数字证书
1、生成公钥与私钥
ssh-keygen -t rsa
[root@bicheng /]# 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:
SHA256:r3kb9w7i9Er9AlD+R9dTmBv2YElUgDM