Page 1 of 1

SSH - Connection closed by remote host.

Posted: 19. Jun 2009, 09:37
by iBurger
ssh_exchange_identification: Connection closed by remote host

If I try to SSH into my Debian guest VM, I get this result:

Code: Select all

laptop@laptop:~$ ssh -p 22000 burger@debian2 -vvv
OpenSSH_4.7p1 Debian-8ubuntu1.2, OpenSSL 0.9.8g 19 Oct 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to debian2 [127.0.0.1] port 22000.
debug1: Connection established.
debug1: identity file /home/laptop/.ssh/identity type -1
debug1: identity file /home/laptop/.ssh/id_rsa type -1
debug1: identity file /home/laptop/.ssh/id_dsa type -1
ssh_exchange_identification: Connection closed by remote host
I did work before I deleted my VM machine and started all over again.

This thing really got me.. i'm clueless. (read a lot about it online)

Re: SSH - Connection closed by remote host.

Posted: 19. Jun 2009, 11:55
by vbox4me2
Did you re-setup port forwarding?

Re: SSH - Connection closed by remote host.

Posted: 19. Jun 2009, 12:29
by iBurger
vbox4me2 wrote:Did you re-setup port forwarding?
I think everything is setup properly. The the openssh-server deamon listens on port 22, which I forwarded to 22000 on my host machine.

I'm very skeptic about the the SSH-keys, however, not experienced enough how to reset everything to default. I have deleted
the ~/.ssh/ folder at the host machine. (where I try to connect to).

In the VM itself, I can SSH to localhost, so the SSHD is setup properly I think.

debian.xml

Code: Select all

      <ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" value="TCP"/>
      <ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" value="22"/>
      <ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" value="22000"/>

debian guest: openssh-server deman configuration (sshd_conf)

Code: Select all

# Package generated configuration file
# See the sshd(8) manpage for details

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication no
#AuthorizedKeysFile	%h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

UsePAM yes

Re: SSH - Connection closed by remote host.

Posted: 19. Jun 2009, 12:51
by baf
Do you have anything in /etc/hosts.allow and /etc/hosts.deny except comments?

Re: SSH - Connection closed by remote host.

Posted: 27. Jun 2009, 10:32
by iBurger
I never solved this, but instead I moved on to my real machine. (no virtualization).
After all, I think that I somehow messed up my SSH setup on the host machine.