2
我是一個AWS機器上遠程運行如下命令:蟒蛇SSH
key = 'myPemFile.pem'
target = <machine_ip>
cmd = 'ssh -i ' + key + ' [email protected]'+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不要問這個問題?
嗯...變得 「命令行0:缺少是/否/問題的參數。」 – eran 2013-04-30 12:56:50
我編輯與您的siuggestion的問題。仍然不起作用。 – eran 2013-04-30 13:00:30
我的不好,這個作品!使用「是」而不是「否」... – eran 2013-04-30 13:02:38