最流行的两种SSH身份验证机制是基于密码的身份验证和基于公钥的身份验证。使用SSH密钥通常比传统的密码身份验证更安全和方便。 |
环境
客户端:CentOS8 192.168.43.137
服务端:CentOS8 192.168.43.139
创建SSH公私钥
通过输入以下命令,生成新的4096位的SSH密钥对:
[root@localhost ~]# ssh-keygen -t rsa -b 4096 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:ycOtSDK8ud2kd6EH7OxoQuc1BFb1HJ3T/kvAQJt0LrI root@localhost.localdomain The key's randomart image is: +---[RSA 4096]----+ | ...oo.o o | | o .+=.+ .| |