我有一个脚本,它使用此代码从服务器获取文件以打开会话。
sftp -o port="port" -o IdentityFile="private_key_location" "username@remote_host"
Run Code Online (Sandbox Code Playgroud)
手动运行它会成功下载文件。
但是当我使用调度程序运行脚本时,它失败并提示
No RSA host key is known for [remote_host]:port and you have requested strict checking
Host key verification failed.
Couldn't read packet: Connection reset by peer
Run Code Online (Sandbox Code Playgroud)
private_key_location另一个用户也可以访问我的。我读过~/.ssh/known_hosts执行脚本的地方可能没有我在~/.ssh/known_hosts.
如果另一个用户仍然可以访问我的private_key_location.
谢谢。