概述
两台测试机,分别为
192.168.247.135
192.168.247.128
在192.168.247.128执行如下操作
# 执行命令,,会自动创建对应目录,并生成密钥文件
[root@192 ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 直接回车确认
Created directory '/root/.ssh'.
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.
# 默认的证书目录:/root/.ssh
# 默认创建的公钥文件:/root/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:vyzrBLXe3wqRWPMETXjMaExbOjysncNSah0ni1yAEcw root@192.168.247.128
The key's randomart image is:
+---[RSA 3072]----+
| oo+.ooBo |
| E +=== |
| ..#.o |
| o & & |
| . S X . |
| + + o |
| o + |
| ... + . |
| .ooo o.. |
+----[SHA256]-----+
# 直接将公钥文件存入对端的对应文件,这个目录需要手动创建
[root@192 ~]# scp /root/.ssh/id_rsa.pub root@192.168.247.135:/root/.ssh/authorized_keys
The authenticity of host '192.168.247.135 (192.168.247.135)' can't be established.
ECDSA key fingerprint is SHA256:ZX5jD2hAw5ddo/oMj/QgfBB+CPr9FG8/aaPnz6epS34.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.247.135' (ECDSA) to the list of known hosts.
root@192.168.247.135's password: # 输入对端密码
id_rsa.pub 100% 574 602.6KB/s 00:00
# 远程操作测试
[root@192 ~]# ssh 192.168.247.135
Activate the web console with: systemctl enable --now cockpit.socket
This system is not registered to Red Hat Insights. See https://cloud.redhat.com/
To register this system, run: insights-client --register
Last login: Wed Dec 15 18:38:19 2021
[root@192 ~]#
# 成功
最后
以上就是灵巧斑马为你收集整理的Linux ❉ Redhat 8密钥ssh服务器的全部内容,希望文章能够帮你解决Linux ❉ Redhat 8密钥ssh服务器所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复