I need to check a bunch of servers via SSH (RAM, disk, CPU model, etc).
I want to make a script for it. But the RSA key yes/no is getting in the way.
Is it possible to auto accept the RSA key while connecting to the server via SSH?
(I.e. ssh root@ip "yes" or some workaround?)
To tell ssh
not to worry about host keys, simply set the StrictHostKeyChecking
option to no
, i.e.
ssh -o StrictHostKeyChecking=no root@ip
If you also want to pass the password to it, you can do that using sshpass
:
sshpass -p your_password ssh -o StrictHostKeyChecking=no root@ip
However, you'd be much better off using an ssh agent (such as PAgeant) and ssh key pairs - better than having your password hard-coded into a script somewhere.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With