How to avoid/omit/suppres this prompt when connecting? I need to connect to a server via a script but the script stops at this point..

sftp -i /var/id_rsa_test user@host
The authenticity of host '[host]:22 ([xx.xx.xx.xx]:22)' can't be established.
DSA key fingerprint is e1:e2:29:c4:30:9a:8c:de:3f:3d:97:cd:6d:dd:6f:e5.
Are you sure you want to continue connecting (yes/no)?

2 Answers 2


I found a solution.. Just add -o StrictHostKeyChecking=no to the command



ssh-keyscan host >> ~/.ssh/known_hosts

as per man ssh-keyscan

ssh-keyscan — gather ssh public keys

note that you should do it only once.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .