Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle ssh key?

Tags:

linux

ssh

perl

system("ssh test.host.com");

its asking for permentaly add key or not ?

I want automatically it should say yes !

like image 504
Tree Avatar asked Jan 22 '26 00:01

Tree


1 Answers

The fact that ssh asks if you want to connect even if the host's public key isn't checked yet is the result of having StrictHostKeyChecking ask (or yes) in your /etc/ssh/ssh_config or ~/.ssh/config. You can set it to no if you want to automatically add unknown host keys to your known_hosts file. If you don't want to make this a permanent configuration change, you can also use it on the command line:

system("ssh -o StrictHostKeyChecking=no test.host.com");

In either case, ssh will issue a warning on host key mismatches an will disable password authentication because of possible man-in-the-middle attacks. You can still login with public-key authentication.

like image 131
Jonas Avatar answered Jan 24 '26 16:01

Jonas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!