使用
在需要连接其他服务器的系统生成密钥对
ssh-keygen -t rsa/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"The authenticity of host '172.16.8.11 (172.16.8.11)' can't be established.ECDSA key fingerprint is SHA256:IpS8Vw0F/Yxece36yQ9KhoIuxHFjSi/Ect/WHGxw//k.ECDSA key fingerprint is MD5:03:85:10:9a:21:75:d6:f1:7a:6e:fd:a8:08:c5:ef:59.Are you sure you want to continue connecting (yes/no)? yes <== 是否继续连接,回答为yes/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keysroot@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/*
