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 is may sound like a weird prob. I am able to seamlessly ssh to remote hosts and also to "localhost".

As part of requirement, I have modified the /etc/hosts file with below entries:

127.0.0.1 localhost # we all know this
10.45.65.1 master # static IP address of my local machine with alias "master"

I can do this : ssh localhost

But when I try : ssh -v master, I get below error -

OpenSSH_5.3p1 Debian-3ubuntu7, OpenSSL 0.9.8k 25 Mar 2009
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to master [10.42.43.1] port 22.
debug1: Connection established.
debug1: identity file /home/hduser/.ssh/identity type -1
debug1: identity file /home/hduser/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/hduser/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3p1 Debian-3ubuntu7
debug1: match: OpenSSH_5.3p1 Debian-3ubuntu7 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3p1 Debian-3ubuntu7
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@       WARNING: POSSIBLE DNS SPOOFING DETECTED!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The RSA host key for master has changed,
and the key for the corresponding IP address 10.42.43.1
is unchanged. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
Offending key for IP in /home/hduser/.ssh/known_hosts:14
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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
d0:ff:f0:68:2d:6c:95:7b:89:71:df:99:6b:48:15:a2.
Please contact your system administrator.
Add correct host key in /home/hduser/.ssh/known_hosts to get rid of this message.
Offending key in /home/hduser/.ssh/known_hosts:2
RSA host key for master has changed and you have requested strict checking.
Host key verification failed.

Any suggestions ?

share|improve this question

3 Answers 3

SSH stores "fingerprints" of hosts you ever connected to in ~/.ssh/known_hosts. Supposedly, you already connected to master at some time in the past and at that time it was a different machine.

Just remove ~/.ssh/known_hosts (which will make SSH to forget hosts it ever connected to, so it'll start asking you "do you want to connect" again), or open it in a text editor and remove the line which contains that host.

share|improve this answer
    
Thx it worked when I renamed the known_hosts file. Before I saw your reply, I happen to use ssh-keygen -R master, and the output itself was an error: /home/hduser/.ssh/known_hosts is not a valid known_hosts file. Not replacing existing known_hosts file because of errors –  stholy Nov 7 '12 at 2:22

As already answered or to delete only the offending line (notice the :2 suffix in the error message, meaning the stored fingerprint is the second line of the file):

sed -i 2d /home/hduser/.ssh/known_hosts

Or disable strict checking of the host keys entirely:

Create or edit the file /home/hduser/.ssh/config and add:

Host *
    StrictHostKeyChecking no

(or specifically disable it only for Host master)

share|improve this answer

Thx it worked when I renamed the known_hosts file. Before I saw your reply, I happen to use ssh-keygen -R master, and the output itself was an error: /home/hduser/.ssh/known_hosts is not a valid known_hosts file. Not replacing existing known_hosts file because of errors

Thx to all for their answers.

share|improve this answer

Your Answer

 
discard

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.