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.


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.