连接时如何避免/省略/抑制此提示?我需要通过脚本连接到服务器,但脚本此时停止。
sftp -i /var/id_rsa_test user@host
The authenticity of host '[host]:22 ([xx.xx.xx.xx]:22)' can't be established.
DSA key fingerprint is e1:e2:29:c4:30:9a:8c:de:3f:3d:97:cd:6d:dd:6f:e5.
Are you sure you want to continue connecting (yes/no)?
答案1
我找到了解决方案..只需添加-o StrictHostKeyChecking=no
到命令中
答案2
尝试
ssh-keyscan host >> ~/.ssh/known_hosts
根据 man ssh-keyscan
ssh-keyscan — 收集 ssh 公钥
请注意,您应该只执行一次。