Skip to content

Jenkins Host Key Verification Failed When Testing Ssh

Host Key Verification Failed when Testing SSH#

You have added the Jenkins user’s public SSH key to the server, but the connection still fails.

Test the connection:

ssh -T user@hostname

The result is:

host key verification failed.

Get more detail with verbose SSH output:

ssh user@hostname -v

You will probably get an error about no permission to /dev/tty.

The fix I found was to specify the shell when switching to the jenkins user:

sudo su -s /bin/bash jenkins

Now test SSH again from that shell.

Source#