Prevent asking to add to known_hosts
buismaarten opened this issue · 4 comments
Hi there,
The SSH command only connects when the host is added to the local known_hosts file. When I connect to a server for the first time it will not work.
When I use the following options with the command it will work.
-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
References:
I'd accept a PR that adds this to the package. By default it should add this. There should be a new method called EnableStrictHostKeyChecking
to turn on the behaviour. The tests + readme should be updated.
@freekmurze this is horrible. This key thing is done by design. The proper way to use keychecking is to let SSH know ahead of time which host keys you will be willing to accept with:
https://man.openbsd.org/ssh-keyscan.1
https://linux.die.net/man/1/ssh-keyscan
I can image a scenario in which the UserKnownHostsFile
is simply a temp file per session. The only thing the package needs is to know the ip or hostname of the target server (which it knows :)).
I will create a PR for this in a little bit.
Thinking about it some more, I agree, and we should change this behaviour.
We'll continue this in #17