1.执行指令
ssh-keygen -t rsa
==使用rsa协议生成公匙和私匙==
2.三次确认,使用默认存放位置,密码为空,确认密码为空
[root@iZbp1gg50ddqbgxf1jpqwwZ ~]# 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:291afX8QKD/Ys+Ji/tbtKyC/lZXfSNoqmV6IVlFiy/U root@iZbp1gg50ddqbgxf1jpqwwZ The key's randomart image is: +---[RSA 2048]----+ | o o | | o = . | | + .E | | ... .. | | S .= +. | | .=oo=B.+.| | +oo=*==.=| | .o Bo++. +| | o.*=+ooo.o| +----[SHA256]-----+
3./root/.ssh 公匙和私匙存放位置
[root@iZbp1gg50ddqbgxf1jpqwwZ .ssh]# ll total 8 -rw------- 1 root root 0 Jan 16 21:37 authorized_keys -rw------- 1 root root 1679 Jan 20 15:40 id_rsa -rw-r--r-- 1 root root 410 Jan 20 15:40 id_rsa.pub
4.开放公匙登录服务器
cat id_rsa.pub >> authorized_keys
来源:https://www.cnblogs.com/jenkins/p/12228559.html