问题描述
在使用秘钥(无密)登录服务器时有如下警告:
Warning: the ECDSA host key for '${hostname}' differs from the key for the IP address '${hostip}'
解决方案
方案1: ssh是添加参数 -o UserKnownHostsFile=/dev/null
方案2: ssh-keygen -R ${hostip}
方案3:在ssh配置文件 ~/.ssh/config文件中添加如下配置:
UserKnownHostsFile /dev/null
ssh 黄金参数:
ssh -o ConnectTimeout=3 -o ConnectionAttempts=3 -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o ServerAliveInterval=60 -o UserKnownHostsFile=/dev/null $user@$host
ssh配置文件实例:
Host * User xxx StrictHostKeyChecking no CheckHostIP no ConnectTimeout 3 ConnectionAttempts 3 PasswordAuthentication no StrictHostKeyChecking no ServerAliveInterval 60 UserKnownHostsFile /dev/null
标签:no,主机,dev,秘钥,UserKnownHostsFile,ssh,null From: https://www.cnblogs.com/276815076/p/16882032.html