eran
eran

Reputation: 15136

python ssh without authenticity validation

I am running a command remotely on an AWS machine like this:

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)

This works fine, but if it is the first login onto the machine I get the question:

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)

how do I "input" "yes" from python, or alternatively, use a flag to tell ssh not to ask the question?

Upvotes: 3

Views: 3672

Answers (1)

vmalloc
vmalloc

Reputation: 841

Try to pass -o StrictHostKeyChecking=no to the ssh command.

Upvotes: 5

Related Questions