I'm running a VM using Oracle's VirtualBox. The OS is the latest version of Arch, 64-bit.

For some odd reason, every so often (frequently enough to be very annoying and making it almost impossible to get work done) my SSH connection just drops with "Server unexpectedly closed connection".

I have another server running almost exactly the same way, but it is not a VM. I am able to hold a connection with it just fine. So my thinking is it has something to do with VirtualBox not behaving.

How can I start debugging this?

EDIT: I am connecting from the base machine (Win 7) to the VM using PuTTy.

  • @Anthon Why was my post edited? It seemed to be a very small change so I'm not sure what is gained by it..?
    – Rogue
    Mar 14 '15 at 15:57
  • 1
    You stated the obvious, if you had found something you would unlikely be here. As per the help-tour, trying to keep down the chit-chat, less is more. But you can always roll-back
    – Anthon
    Mar 14 '15 at 15:59
  • OK, thank you very much. I see what you mean now.
    – Rogue
    Mar 14 '15 at 16:02

You should set

TCPKeepAlive yes

in you /etc/ssh/ssh_config or ~/.ssh/config on your client, or /etc/ssh/sshd_config of your server. I am running VMs and ssh out an in of them, with this setting I have not had any recurring problems.

You can also increase the loglevel by starting the server with -v, or (often easier) adding LogLevel DEBUG to your /etc/ssh/sshd_config (there is also DEBUG2 and DEBUG3 (see man sshd_config).

  • I am still getting the same problem. I am using PuTTy from Windows, not ssh on another Linux machine. That might be helpful information.
    – Rogue
    Mar 14 '15 at 16:09
  • @RogueBukkitDev You could put that in your post (just update, no Edit: necessary, we can see the history). Can you start Putty with verbose on? Also update the info on how to start the server with debug on
    – Anthon
    Mar 14 '15 at 16:12

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.