误删除SSH Key或修改云主机密钥,怎么办?
现象
云主机无法使用密钥连接。
原因
云主机密钥丢失或更新了密钥。
解决方案
操作步骤
-
在云主机系统内执行以下命令,重新生成密钥:
[root@localhost ~]# ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): # 点击【回车】 /root/.ssh/id_rsa already exists. Overwrite (y/n)? # 点击【回车】 -
执行以下命令,配置免密,并将密钥发送至对端云主机:
[root@localhost ~]# ssh-copy-id $IP
