Is there a way to auto accept any RSA key inside a bash script with no user interference? I need this script to run without user intervention and it will stop every time it encounters a new ip, i just need it to accept all of them.


1 Answer 1


If all you need is to accept new unknown hosts, try this:

 ssh -o StrictHostKeyChecking=no

If you also need to accept changed host keys, you can trick SSH into using a blank file for storing it's local set of known host keys, then accepting new unknown ones. Note this is a Bad Idea™:

ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no

You must log in to answer this question.

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