Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am able to use ssh from terminal but I am not able to use it from "connect to Server.." utility. it is showing the error in the dialog box as below:

Cannot display location "sftp://username@IP.IP.IP.IP:PORT/
"Host key verification failed"

Why so?

From terminal using below command I am able to access the server:

ubuntu# ssh -p 2222 username@IP.IP.IP.IP

Description:    Ubuntu 10.04.4 LTS
Release:    10.04
Codename:   lucid

Why is the host key verification failing?

share|improve this question
Do you know where unity stores its authorized keys? Is it in the user dir or a system dir? Basically you have to flush/delete the entry for the key of the other server (assuming it has legitimately changed). – niallhaslam Oct 18 '12 at 9:25
I know that but I dont know where it stores the authorized key. – rambo Oct 18 '12 at 9:49
yepii... I solved it. i just change known_hosts file. ubuntu#mv known_hosts known_hots_ and there you go. It is working now. thank you ubuntu. – rambo Oct 18 '12 at 10:21

There is a file called known_hosts, typically in the user directory ~/.ssh/ - this contains the keys that ssh and other services use to authenticate remote machines that you connect to. If the key for a particular server has been updated for example during an update of the OS then a new key for that server will be generated on that server. Since this conflicts with the stored key on your machine ssh will ask if you still trust that machine.

The first time you connect to a machine ssh will ask you if you trust that key. If you do then that key is copied to the known_hosts file for that user.

Look in the known_hosts file and remove the entry for the remote machine. Now when you connect you should be asked to accept the new key. By moving the file, you will probably have triggered the creation of a new known_hosts file for the first key that you import and will have lost the records of the other machine you may have connected to.

share|improve this answer
+1 for recommending to edit known_hosts rather than deleting it, which I see far too often. – Tom Brossman Dec 21 '14 at 13:36

You can also remove just the offending key with this command:

ssh-keygen -f "~/.ssh/known_hosts" -R hostname_or_ip_address
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.