# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter fileinwhich 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.
The key fingerprint is:
SHA256:kOnILhdyY728XRfFBvV+nikrS3Y0Zt7mNmfqXV6glL0 root@qa-db001.arcu
The key's randomart image is:
+---[RSA 3072]----+
|... || o o .|| + + .||. + .=.||. B o S +=o o||= + . .=oo++||. o o .oo+E=+|| o o .oo. ===||.. .oo++=|
+----[SHA256]-----+
# 注意:在程序提示输入 passphrase 时直接输入回车,表示无证书密码。# 上述命令将生成私钥证书 id_rsa 和公钥证书 id_rsa.pub,存放在用户目录的 .ssh 子目录中。# 将公钥证书复制到目标机器中# scp -r /root/.ssh/id_rsa.pub root@目标服务器IP:/tmp/
源服务器# ssh-keygen -t rsaGenerating 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 agai