6

I have a old laptop that I'm using to learn Ubuntu Server 12.10. Prior to reformatting and installing Ubuntu Server, Ubuntu Desktop was used.

With Ubuntu Desktop, I was using a no-ip.com hosted domain to access the machine via ssh (no problems). After the reformat, I'm trying to use that same no-ip.com domain to access this same machine (same static ip on home LAN) but now I'm receiving the following error:

   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 a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX: (Omitted).
Please contact your system administrator.
Add correct host key in /home/guest/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/guest/.ssh/known_hosts:2
  remove with: ssh-keygen -f "/home/guest/.ssh/known_hosts" -R username.no-ip.org
ECDSA host key for username.no-ip.org has changed and you have requested strict checking.
Host key verification failed.

Admittedly, I don't understand much of the error message. After some google searching I opted to run the following command:

$ ssh-keygen -R {username.no-ip.org}

Which gives the following error:

ssh-keygen: /home/jerry/.ssh/known_hosts: No such file or directory

"Guest" as suggested in the error message, isn't there either:

jerry@mediaserver:/home$ tree -a
.
└── jerry
    ├── .bash_history
    ├── .bash_logout
    ├── .bashrc
    ├── .cache
    │   └── motd.legal-displayed
    ├── .config
    │   └── htop
    │       └── htoprc
    └── .profile

Which begs the following questions: if this file doesn't even exist, where's the discrepancy noted in the error message? Perhaps I need to create this file?

Thanks to anyone willing to work through this with me!

-Jerry

EDIT:

I should add that I am able to ssh locally using the locally assigned ip address.

3
  • Did you run ssh as the guest account or as jerry? Did you make changes under /etc/ssh? What does ls -lA /home/guest show? Dec 21, 2012 at 20:13
  • 1
    Is mediaserver the Ubuntu server? Or your local machine?, because you need to edit your local machines known_hosts file not the servers.
    – squareborg
    Dec 21, 2012 at 20:22
  • Thanks Stephen for that insight. That indeed is the problem (face-palm)
    – jerrycrabb
    Dec 21, 2012 at 21:32

1 Answer 1

5

The warning means the host id has changed (from the old to the new installation). That's good! It works, letting you know it has changed...

Log in as the unprivileged user (not root) and create the hidden directory, /home/jerry/.ssh:

cd; mkdir .ssh; chmod 0700 .ssh

At that point you can add hosts to the known_hosts file (/home/jerry/.ssh/known_hosts).

Or, if you connect as guest, do the same as the user, guest, not jerry.

Note that should you desire the .ssh directory to be created for all new users, then add a the .ssh directory to /etc/skel. The /etc/skel directory contains files and directories that all new users should have.

sudo mkdir /etc/skel/.ssh; sudo chmod 0700 /etc/skel/.ssh

Afterward, every new user you create will have a .ssh directory with the right perms (0700).

1

Not the answer you're looking for? Browse other questions tagged .