Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 hosted domain to access the machine via ssh (no problems). After the reformat, I'm trying to use that same domain to access this same machine (same static ip on home LAN) but now I'm receiving the following error:

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
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
ECDSA host key for 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 {}

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
    │   └──
    ├── .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!



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

share|improve this question

closed as too localized by Gilles, fabricator4, Ringtail, fossfreedom Dec 22 '12 at 7:08

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

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? – Gilles Dec 21 '12 at 20:13
Is mediaserver the Ubuntu server? Or your local machine?, because you need to edit your local machines known_hosts file not the servers. – squarebear Dec 21 '12 at 20:22
Thanks Stephen for that insight. That indeed is the problem (face-palm) – jerrycrabb Dec 21 '12 at 21:32
up vote 3 down vote accepted

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).

share|improve this answer
This doesn't explain the guest/jerry discrepancy. – Gilles Dec 21 '12 at 20:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.