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 脚本应该就正常了。

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐