How to accept yes from script "Are you sure you want to continue connecting (yes/no)?"

This is by design. ssh's host verification and authentication interactions deliberately do not accept input from pipes. However, you can if you are confident in your host keys do:

ssh-keyscan host.example.com >> $HOME/.ssh/known_hosts
ssh host.example.com

If you don't care to authenticate the hosts via SSH and either blindly accept the keys from servers or ignore them, better to just ignore them.

$ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no <user>@<host>

Keep in mind that you're arm tying SSH's ability to protect you but this is the more appropriate way to use the tools as they're intended vs. forcing them through external means.

Tags:

Linux

Ssh