1. 问题描述
在 jenkins
中执行下面的 shell
语句时
sshpass -p "123456" scp -r * dep@192.168.1.100:/home/dep/Desktop/
报错
Host key verification failed.
可能原因是由于首次登录时需要输入 yes
导致无法连接成功。
The authenticity of host '192.168.1.100 (192.168.1.100)' can't be established.
ED25519 key fingerprint is SHA256:XjsUMxMz5XMwngdwR5VrKj7Dr2SciJvXDr6EtEMuwU0.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.1.100' (ED25519) to the list of known hosts.
dep@192.168.1.100's password:
解决方案:
sudo su -s /bin/bash jenkins
再次执行上面的 scp
脚本,输入 yes
之后,后续再执行 shell
脚本应该就正常了。