LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 07-08-2010, 07:06 AM   #1
abti
LQ Newbie
 
Registered: Sep 2008
Location: Ohio
Distribution: RHEL6&7 (work) Fedora&Ubuntu(home)
Posts: 25
Blog Entries: 1

Rep: Reputation: 16
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.
 
Old 07-08-2010, 07:13 AM   #2
troop
Member
 
Registered: Feb 2010
Distribution: gentoo, arch, fedora, freebsd
Posts: 379

Rep: Reputation: 97
remove 192.168.0.1 from your known_hosts file line 112.
 
Old 07-08-2010, 07:15 AM   #3
abti
LQ Newbie
 
Registered: Sep 2008
Location: Ohio
Distribution: RHEL6&7 (work) Fedora&Ubuntu(home)
Posts: 25

Original Poster
Blog Entries: 1

Rep: Reputation: 16
There is no 192.168.0.1 in the known_hosts file.
 
Old 07-08-2010, 08:48 AM   #4
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Rep: Reputation: 55
Remove line 112 and 349 from known hosts.
 
Old 07-08-2010, 10:31 AM   #5
abti
LQ Newbie
 
Registered: Sep 2008
Location: Ohio
Distribution: RHEL6&7 (work) Fedora&Ubuntu(home)
Posts: 25

Original Poster
Blog Entries: 1

Rep: Reputation: 16
I've tried that. I've removed all records of myServer and 192.168.0.1 from the known_hosts file.
 
Old 07-08-2010, 10:36 AM   #6
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Rep: Reputation: 55
Quote:
Originally Posted by abti View Post
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
 
Old 07-08-2010, 11:12 AM   #7
abti
LQ Newbie
 
Registered: Sep 2008
Location: Ohio
Distribution: RHEL6&7 (work) Fedora&Ubuntu(home)
Posts: 25

Original Poster
Blog Entries: 1

Rep: Reputation: 16
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.
 
Old 07-08-2010, 11:22 AM   #8
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Rep: Reputation: 55
Quote:
Originally Posted by abti View Post
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.
 
Old 07-08-2010, 11:34 AM   #9
abti
LQ Newbie
 
Registered: Sep 2008
Location: Ohio
Distribution: RHEL6&7 (work) Fedora&Ubuntu(home)
Posts: 25

Original Poster
Blog Entries: 1

Rep: Reputation: 16
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
=========
 
Old 07-08-2010, 11:52 AM   #10
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Rep: Reputation: 55
YOu have to clear known_hosts on your computer, not the server.
 
Old 07-08-2010, 12:00 PM   #11
abti
LQ Newbie
 
Registered: Sep 2008
Location: Ohio
Distribution: RHEL6&7 (work) Fedora&Ubuntu(home)
Posts: 25

Original Poster
Blog Entries: 1

Rep: Reputation: 16
Quote:
Originally Posted by abti View Post
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.
 
Old 07-08-2010, 02:19 PM   #12
abti
LQ Newbie
 
Registered: Sep 2008
Location: Ohio
Distribution: RHEL6&7 (work) Fedora&Ubuntu(home)
Posts: 25

Original Poster
Blog Entries: 1

Rep: Reputation: 16
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?
 
Old 01-09-2013, 06:45 AM   #13
dgodbey
LQ Newbie
 
Registered: Jan 2006
Location: Bel Air MD
Distribution: Fedora
Posts: 16

Rep: Reputation: 1
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.
 
  


Reply

Tags
ssh



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Single LAN port inexplicably changes RSA host key... pjd83 Linux - Networking 2 02-20-2010 04:57 PM
can't start sshd. Error is "Generating SSH1 RSA host key [FAILED] ryannlinux Linux - Newbie 9 03-20-2009 03:42 AM
A question about rsa host key fingerprints lawrence_lee_lee Linux - Software 8 07-17-2008 09:58 PM
Possible to have multiple SSH accounts & clients using the same RSA key on server?? a2brute Linux - Server 2 03-31-2008 12:25 PM
RSA host key for 172.17.5.60 has changed ssharma_02 Red Hat 3 11-15-2006 09:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 12:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration