Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question already has an answer here:

When I am trying to transfer files using SCP command I'm getting this error (Removed my IP and RSA key):

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
------------------------(RSA key)
Please contact your system administrator.
Add correct host key in /home/users/myaccount/.ssh/known_hosts to get rid of this message.
Offending key in /home/users/myaccount/.ssh/known_hosts:4
RSA host key for 'my IP' has changed and you have requested strict checking.
Host key verification failed.
lost connection

I am using newly installed Ubuntu 12.04 and I can connect to this server using ssh. Any help?

share|improve this question

marked as duplicate by Alaa Ali, Radu Rădeanu, bcbc, Eric Carvalho, Kevin Bowen Sep 5 '13 at 2:51

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
Can you post the full error message –  Manula Waidyanatha Jun 7 '12 at 9:53
    
i've edited my question with the full message included –  rvsi Jun 7 '12 at 9:59

3 Answers 3

You have to remove the 4th ssh key from /home/users/myaccount/.ssh/known_hosts file.

share|improve this answer
    
Thank you..It is working now. –  rvsi Jun 7 '12 at 10:15

This can easily happen when connecting to a computer who's host keys in /etc/ssh have changed if that computer was upgraded without copying its old host keys. The host keys here are proof when you reconnect to a remote computer with ssh that you are talking to the same computer you connected to the first time you accessed it.

If the remote computer is within your control you probably know if it was updated and the host keys not copied. If so, and if the system is on your LAN you can be pretty safe in ignoring or circumventing this error message. You probably know its IP address with certainty and know there are no trojan devices on it.

If the computer is not within your control but you are certain that it has been upgraded it may also be reasonable to circumvent this error message. (If the remote host publishes the hashes of its ssh host keys you may be able to check these to be safer, or you can call the server's management to obtain the host key fingerprint).

If the computer is within your control you should copy the old host keys from /etc/ssh to the new system as part of your upgrade procedure. (N.B. there are both key files and configuration files in this directory.)

Once you know you want to ignore this condition there are at least 2 ways to deal with this issue.

  • Pass the StrictHostKeyChecking in the SSH command such as (example) :

ssh -o 'StrictHostKeyChecking no' user@host

You'll have to do this each time. Or ...

  • Remove the offending ssh key (real example taken from your answer) :

sed -i '4d' /home/users/myaccount/.ssh/known_hosts

This is the more permanent solution. Instead of giving you the above message you will be given the option to accept the new hostkey from the server, just as you did the very first time you connected to it. Verify the best you can that you are connecting to the correct remote computer, without going through an intermediary, and then accept the new host key.

share|improve this answer
    
ah.. that's a nice explanation...thanks. –  rvsi Jun 8 '12 at 5:31

It seems that you copied your ssh-folder from an old system to your new one.

Open terminal and type in:

rm /home/USERNAME/.ssh/known_hosts

This will delete all the "old" keys.

share|improve this answer
1  
thank you for your help.That worked. –  rvsi Jun 7 '12 at 10:14

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