使用

在需要连接其他服务器的系统生成密钥对

  1. ssh-keygen -t rsa
  2. /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
  3. The authenticity of host '172.16.8.11 (172.16.8.11)' can't be established.
  4. ECDSA key fingerprint is SHA256:IpS8Vw0F/Yxece36yQ9KhoIuxHFjSi/Ect/WHGxw//k.
  5. ECDSA key fingerprint is MD5:03:85:10:9a:21:75:d6:f1:7a:6e:fd:a8:08:c5:ef:59.
  6. Are you sure you want to continue connecting (yes/no)? yes <== 是否继续连接,回答为yes
  7. /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
  8. /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
  9. root@172.16.8.11's password: <==输入远程主机的密码

将公钥传至服务器

ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.168.168

使用

ssh 192.168.168.168

修改

进入对应目录

ssh-keygen -p

删除

直接进入对应目录删除即可

rm -rf /root/.ssh/*

引用

https://blog.csdn.net/u014721096/article/details/78553032