我在这样的 AWS 机器上远程运行命令:
key = 'myPemFile.pem'
target = <machine_ip>
cmd = 'ssh -i ' + key + ' ubuntu@'+target+' "nohup myprog + ' >& /dev/null < /dev/null &" &'
proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
这工作正常,但如果它是第一次登录到机器上,我会得到一个问题:
The authenticity of host '144.224.18.97 (144.224.18.97)' can't be established.
ECDSA key fingerprint is e2:4e:...:e3:73:07.
Are you sure you want to continue connecting (yes/no)
我如何从python“输入”“是”,或者使用标志告诉ssh不要问这个问题?