生成秘钥:
ssh-keygen
把公钥拷贝到需要登录的远程服务器或Linux系统上,这里可以使用ssh-copy-id
cd ~/.ssh
ssh-copy-id -i id_rsa.pub llb@llb-desktop.local OR ssh-copy-id -i id_rsa.pub rc@llb-robot.local
ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.100.10
ssh远程登录报错REMOTE HOST IDENTIFICATION HAS CHANGED!解决方式及原因
之前使用提示中的
remove with: ssh-keygen -f "/home/hicode/.ssh/known_hosts" -R ip.ip.ip.ip
删除了也就ok了。只是今天说是
/home/hicode/.ssh/known_hosts is not a valid known_hosts file.
Not replacing existing known_hosts file because of errors
我也不知道为什么。要下功夫想想原因了。
解决方式:然而登录时候的报错,当中有一句
Offending ECDSA key in /home/hicode/.ssh/known_hosts:28
删除掉文档中第28
行就可以
sed -i '28d' /home/hicode/.ssh/know_hosts
此时再登录就和第一次ssh登录就一致了。