I have an ESX box which I have loaded with two Ubuntu Server machines.

During setup, I chose no additional packages to install as I just wanted a lightweight machine for testing.

The first thing I did was change the root password via sudo passwd

After ESX got on my nerves through lag, I decided to install OpenSSH via apt-get install openssh-server.

It did it's business, and I then opened putty and could connect in to both machines fine. The first time it connected, it asked me to add the ssh key as obviously it did not know it.

Anyway, the second server is working flawlessly, but, the first seems to be giving me trouble.

I was in the middle of typing a sentence when it kicked me off for no reason and when I tried to reconnect, putty gave me a warning that the ssh key had changed and it is potentially dangerous. I attempted to log in anyway and it did not work, just the standard access denied message.

Using the second machine, I SSHed in to the first machine and it worked straight away, I then killed the SSH sessions (and possibly SSH server), I then reconnected via putty and I again received the security warning message, but, it allowed me to log on fine.

... I thought "glitch" and nothing more of it, but, it just happened again!

I really do not understand this and was hoping someone here can help?

  • 3
    Running sudo passwd for the first time on an Ubuntu system doesn't change root's password; it creates one, enabling the root account. Before doing so, you cannot log in as root at all. It is recommended not to enable the root account, and enabling root logins, while possible (you've done it), is neither encouraged nor supported in Ubuntu. I recommend that you re-disable your root account with sudo passwd -dl root. You can perform all administrative tasks from a non-root admin account using sudo and similar utilities. – Eliah Kagan Nov 22 '11 at 17:59
  • @EliahKagan Thanks... Hmm... Reading that document, a lot to consider! – wilhil Nov 22 '11 at 22:27

The most likely explanation for why you were kicked off of one of your virtual servers, and why you were warned that its SSH key had changed, is that the server's IP address changed. This would have resulted in it going down for a short time (or, if you're using DHCP, was perhaps the result of it going down for a short time). That is, either the server went down, or, more likely, just its network connection was interrupted. This would have interrupted the SSH connection in progress and also could have resulted in the IP address changing so that when you tried to connect to the same IP, you would have been connecting to a different (possibly virtual) machine (with a different SSH key). Or, so that when you tried to connect to the same machine with a different IP, you may have been connecting to a machine whose IP was the same as the IP address of a machine the client had previously connected to (which would give the same error about the SSH key changing).

|improve this answer|||||
  • Whilst I understand, I am certain that this is not the issue because the server has a static ip, there is no DHCP and, I could SSH in from the other Ubuntu server (on the public IP), it was only when I killed/restarted SSH that I was able to connect in. – wilhil Nov 22 '11 at 22:24
  • @wilhil Quite possibly you could ssh from the other server because its DNS cache was already updated to reflect the new IP address, whereas you couldn't ssh from home because your DNS cache was serving stale data. Are you absolutely positively sure that your server's IP address did not change? How do you know? (Note: did not, not was not supposed to.) – Gilles 'SO- stop being evil' Nov 23 '11 at 0:02
  • I am certain - they are using static IPs, and, I don't get what you mean via DNS cache - I am connecting via IP, not FQDN, so, there shouldn't be any cache - and, I feel like something is wrong as the timing is just too exact - the moment I restart SSH, I am able to connect :/ – wilhil Nov 23 '11 at 0:15
  • I have to mark as answer and thank you so much for the help - I feel like an idiot and you were right about it being redirected - I too thought that this was the most likely cause, but, I had to rule it out based on what I was told... It turned out that someone else had incorrectly set the DRAC and their was an IP conflict. I was only able to prove it after pausing the server and still being able to connect via SSH. The timing of an SSH restart and it working again was weird and I can only assume it restarts the networking stack or similar. Anyway, thanks for the help and sorry! – wilhil Nov 23 '11 at 17:32

For me, it looks like you are using an IP address that is already in use in your network by another SSHD enabled server. It could explain you being dropped and when you reconnect, putty complains about the key changed. Please check it.

|improve this answer|||||
  • Thanks anyway, but, as I said in the other answer, this is not possible :( The server only has one (public) ip address, there is no DHCP, and, I was able to connect in from the other Ubuntu server. – wilhil Nov 22 '11 at 22:25
  • So, this problem only happens when you try to connect via SSH though this machine with putty? Can you try to run SSHD in debug mode to see whats going on? Run "/etc/init.d/ssh stop" and then "/usr/sbin/sshd -d" and try to reproduce the problem again. – Paulo Arruda Nov 22 '11 at 23:24
  • To the first one, I got a warning about using the service program or similar, but, I ran the second and it is running - if it happens again (which I think it will), I will let you know. – wilhil Nov 23 '11 at 0:00
  • Ok... I appear to be in... I will let you know if it goes down again – wilhil Nov 23 '11 at 0:03
  • Thanks for the help, and FYI, you may want to read the comment on the other answer. – wilhil Nov 23 '11 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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