LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (http://www.linuxquestions.org/questions/linux-security-4/)
-   -   rsa host key error while trying to ssh to server (http://www.linuxquestions.org/questions/linux-security-4/rsa-host-key-error-while-trying-to-ssh-to-server-818680/)

abti 07-08-2010 08:06 AM

rsa host key error while trying to ssh to server
 
I get the following error when attempting to ssh to my server:

=========
Warning: the RSA host key for 'myServer' differs from the key for the IP address '192.168.0.1'
Offending key for IP in /home/user/.ssh/known_hosts:112
Matching host key in /home/user/.ssh/known_hosts:349
Are you sure you want to continue connecting (yes/no)?
=========

I have already attempted removing myServer from my known_hosts file and reattempting to ssh. Each time I access myServer I get this error, type yes and then gain access. Even though I gain access, I shouldn't be receiving this error. :confused:

troop 07-08-2010 08:13 AM

remove 192.168.0.1 from your known_hosts file line 112.

abti 07-08-2010 08:15 AM

There is no 192.168.0.1 in the known_hosts file.

abefroman 07-08-2010 09:48 AM

Remove line 112 and 349 from known hosts.

abti 07-08-2010 11:31 AM

I've tried that. I've removed all records of myServer and 192.168.0.1 from the known_hosts file.

abefroman 07-08-2010 11:36 AM

Quote:

Originally Posted by abti (Post 4027407)
I've tried that. I've removed all records of myServer and 192.168.0.1 from the known_hosts file.

It wouldn't be giving that error then, you must have removed it from the wrong known_hosts file

abti 07-08-2010 12:12 PM

Here are my steps: ssh myServer, yes, yes, I'm on myServer

Each time I remove the entry with 'myServer' in it, I get the below error:

=========
The authenticity of host 'myServer' (192.168.0.1)' can't be established.
RSA key fingerprint is xx:xx:xx
Are you sure you want to continue connecting (yes/no)? yes <- I typed
Warning: Permanently added 'myServer' (RSA) to the list of known hosts.
Warning: the RSA host key for 'myServer' differs from the key for the IP address '192.168.0.1'
Offending key for IP in /home/user/.ssh/known_hosts:112
Are you sure you want to continue connecting (yes/no)? yes <- I typed
Last Login: Thur Jul 8 07:13:59 from myComputer.myDomain.com
=========

I still get on the server, however I get the above error.

abefroman 07-08-2010 12:22 PM

Quote:

Originally Posted by abti (Post 4027444)
Here are my steps: ssh myServer, yes, yes, I'm on myServer

What? You are already on myServer and you are trying to SSH to it?

You need to remove the entries from known_hosts on the local server not the remote server.

abti 07-08-2010 12:34 PM

No, sorry. There's been a misunderstanding\miscommunication. Those were my actions. I'm on myComputer sshing to myServer. ACTION: myComputer# ssh myServer PROMPT: Are you sure you want to continue connecting (yes/no)? ACTION: yes PROMPT: Are you sure you want to continue connecting (yes/no)? ACTION: yes RESULT I have successfully ssh'd to myServer from myComputer.

I have removed all myServer entries from the known_hosts file whilest on myComputer and still receive the error:

=========
The authenticity of host 'myServer' (192.168.0.1)' can't be established.
RSA key fingerprint is xx:xx:xx
Are you sure you want to continue connecting (yes/no)? yes <- I typed
Warning: Permanently added 'myServer' (RSA) to the list of known hosts.
Warning: the RSA host key for 'myServer' differs from the key for the IP address '192.168.0.1'
Offending key for IP in /home/user/.ssh/known_hosts:112
Are you sure you want to continue connecting (yes/no)? yes <- I typed
Last Login: Thur Jul 8 07:13:59 from myComputer.myDomain.com
=========

abefroman 07-08-2010 12:52 PM

YOu have to clear known_hosts on your computer, not the server.

abti 07-08-2010 01:00 PM

Quote:

Originally Posted by abti (Post 4027462)
I have removed all myServer entries from the known_hosts file whilest on myComputer and still receive the error:
=========

Yeah, that's what I said. While on myComputer, I remove any/all entries in my known_hosts file. I have other entries, but I'm not about to remove everything in my known_hosts file since I have nearly 300 entries.

abti 07-08-2010 03:19 PM

I think I figured out something. The IP address of myServer was missing from known_hosts file. After sshing to myServer and loging out, I edited my known_hosts file and saw:

myServer ssh-rsa AAAAWEFv4df5asbzasasfeawbnoosdnf0asn0na0
myServer2, 192.168.0.2 ssh-rsa AAAAWEFv0ng0nasdfjw0asnoosdnf0asdfg433bF
myServer3, 192.168.0.3 ssh-rsa AAAAWEFasdfe0ng0n0asnsh6RGsfsfkgTasd0sdg

==

After adding my IP address to myServer, I ssh'd to myServer and got in w/o errors. Do you know what I need to do to have myServer write the IP to my known_hosts file?

dgodbey 01-09-2013 07:45 AM

This happened to me as well. What I noticed is that there were two entries in my client known_hosts file, one under server name, the other under ip address. When I removed both entries, I was able to clear this error.


All times are GMT -5. The time now is 03:10 PM.