LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   SSH Issue - REMOTE HOST IDENTIFICATION HAS CHANGED! (https://www.linuxquestions.org/questions/linux-security-4/ssh-issue-remote-host-identification-has-changed-4175432690/)

Rohit_4739 10-17-2012 08:46 AM

Hello,

I am having this issue regarding at one of our servers. Let me give a little insight on it, i was trying to do ssh to one of our linux server and i was presnted with the following error which i am totally aware of and fully undertands it.
Quote:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 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 is23:00:21:33:d4:0f:95:f1:eb:34:b2:57:cf:3f:2c:e7.Please contact your system administrator.Add correct host key in /home/user/.ssh/known_hosts to get rid of this message.Offending key in /home/user/.ssh/known_hosts:8RSA host key for example.com has changed and you have requested strict checking.Host key verification failed.
So i tried with the options i thought,

1. First i deleted the entry for this server from my known_hosts file on client and then tried the ssh so that its a new connection. But to my surprise the server is not offering the Public HOst Key to accept but is asking for root password for the server.

2. I also tried by setting the StrictHostKeyChecking option to no but even that also did not work.

So my questions here

a) Why server is not offering the new Public Key and asking me "If you want to continue(yes/no)".

b) Afetr removing the server Public Key from known_hosts file it starts asking for password but if the server Public Key is not removed then it does not ask for password. So if I understand correctly known_hosts file has nothing to with password less authentication.

Any help would be greatly appreciated !!

How does SSH client verifies the Server's identity for the very first time before it has been added to known_hosts file.Sorry to say that it might sound little stupid but it is troubling me alot and i have not been able to find the correct precise answer even after intense googling.

What i mean to ask is that how exactly a client comes to know that to the SSH server it has initiated connection is what it says it is. A Man in the Middle system can impersonate the actual SSH server and present its own public key to the client and then client will add it to its known_hosts list.

I know it might sound bit silly or stupid but i am having hard in figuring out How exactly a SSH cleint verifies the SSH server's identity for the very first time when it initiates the connection before it has already added the entry to its known_hosts file.

I have done quite intense googling but i have not still found a precise satisfactory answer, so if someone can please tell me how exactly the clinet comes to know that it is indeed talking to the server to whom it should.

torchnw 10-17-2012 10:01 AM

a) Don't know, but try renaming known_hosts temporarily, in case another entry is causing problems

b) For passwordless login, the public key of the client must be stored in ~/.ssh/authorized_keys for the user you're logging in as on the server.

acid_kewpie 10-18-2012 03:30 AM

it puts the onus on you. By default, you need to manually accept the identity key the server provides. There's clearly no formal basis for knowing a server is legit (compared to trusted root CAs in the HTTPS world) so you have to arbitrarily draw a line yourself by saying you trust them on the first connect.

sundialsvcs 10-18-2012 08:45 AM

The message means exactly what it says, and you should treat it seriously. Each ssh host generates a random string which is its calling-card, and it stores this in .ssh/known_hosts. (Not authorized_keys, which is part of RSA-key based authentication.)

Unless there is a damm good reason why the key is changed, there might be a "man in the middle."

It could be innocuous, it could be explainable, it could be innocent. But there's a reason why SSH is screaming at you about this, and you should heed it. A loud bell has gone off. Don't silence it: find out why it is ringing. (That's what it's there for.)

Rohit_4739 10-18-2012 10:00 AM

Quote:

Originally Posted by sundialsvcs (Post 4809097)
The message means exactly what it says, and you should treat it seriously. Each ssh host generates a random string which is its calling-card, and it stores this in .ssh/known_hosts. (Not authorized_keys, which is part of RSA-key based authentication.)

Unless there is a damm good reason why the key is changed, there might be a "man in the middle."

It could be innocuous, it could be explainable, it could be innocent. But there's a reason why SSH is screaming at you about this, and you should heed it. A loud bell has gone off. Don't silence it: find out why it is ringing. (That's what it's there for.)

I understand that, but all i am asking is that why i am not being offered the new host key by the server. And why server asks for password if i remove the key from known_hosts file and not when the entry is there in known_hosts file.

sundialsvcs 10-19-2012 10:31 AM

I think that the designers didn't want to make it that easy.

I presume that you also have an authorized-keys entry which permits password-free login. My understanding is that the keys are tied to the originating host.

gopa 03-15-2013 10:10 AM

SSH Issue - REMOTE HOST IDENTIFICATION HAS CHANGED! Reply to Thread
 
Try using the below command

# ssh-keygen -R {server-ip-address}

#service network restart

Now try to connect to Remote host.. you will be succeeded.

TB0ne 03-15-2013 12:26 PM

Quote:

Originally Posted by gopa (Post 4912276)
Try using the below command

# ssh-keygen -R {server-ip-address}
#service network restart

Now try to connect to Remote host.. you will be succeeded.

Sorry, neither of those steps will resolve that issue. The issue arises because the IP address/credentials of one of the servers changed, so the entry in "known_hosts" is different. All you need to do is remove it from known_hosts, and the new entry will be added. The steps you are taking won't matter, since you are generating a new key (which you don't need), and restarting networking (which won't matter).

Please don't post advice that's incorrect/misleading, and don't re-open old threads to do it.


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