Suppose I attempt to connect to a remote computer via SSH:

$ ssh [email protected]
The authenticity of host 'example.com (<IP address>)' can't be established.
ECDSA key fingerprint is <key fingeprint>.
Are you sure you want to continue connecting (yes/no/[fingerprint])?

I verify that the displayed fingerprint is indeed correct, and I want to continue connecting. If I enter yes at the prompt, I will continue connecting but SSH will add the fingerprint to ~/.ssh/known_hosts. I do not want SSH to automatically add the fingerprint to the known_hosts file. Is there a way to stop SSH from automatically adding the fingerprint to the known_hosts file if I enter yes? I want to be presented with this same prompt the next time I attempt to connect to this same host.

I am not looking for ssh -o StrictHostKeyChecking=no ... since I want to verify the host key fingerprint (i.e. I want it to be displayed, and I want to be prompted).


1 Answer 1


You can use this option to blackhole entries going in the known hosts file:

ssh -o UserKnownHostsFile=/dev/null [email protected]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .