Can't SSH into my OpenSuse 13.2 machine

Hi,

I am running OpenSuse 13.2 (through Virtual Box). I can access the internet and ssh into computers on my network, but they cannot do the same.

Main problem: When I try to ssh into my machine I get “Connection closed by <IPADDRESS>

It might be helpful to note that I am at work, so I’m not running through a home router.

Can somebody point out what I might be doing wrong? Thank you!

Here’s some information:

  1. How I’m sshing:
ssh root@<IPADDRESS>
ssh james@<IPADDRESS>
  1. sshd_config file:
**root@jlOS # grep ^^#] /etc/ssh/sshd_config**
Protocol 2
PermitRootLogin yes
AuthorizedKeysFile    .ssh/authorized_keys
PasswordAuthentication yes
UsePAM yes
X11Forwarding yes
UsePrivilegeSeparation sandbox
Subsystem    sftp /usr/lig/ssh/stfp-server
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL 
  1. I disabled the firewall entirely for now, but “Secure Shell Server” is in the list of allowed services.

  2. output of “rcsshd status”:

sshd.service - OpenSSH Daemon   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled)
   Active: **active (running)** since Fri 2015-02-27 11:05:24 PST; 10min ago
  Process: 1526 ExecStartPre=/usr/sbin/sshd-gen-keys-start (code=exited, status=0/SUCCESS)
 Main PID: 1620 (sshd)
   CGroup: /system.slice/sshd.service
           └─1620 /usr/sbin/sshd -D


Feb 27 11:05:49 jlOS sshd[1775]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key
Feb 27 11:05:49 jlOS sshd[1775]: error: Could not load host key: /etc/ssh/ssh_host_dsa_key
Feb 27 11:05:49 jlOS sshd[1775]: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Feb 27 11:05:49 jlOS sshd[1775]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Feb 27 11:05:49 jlOS sshd[1775]: fatal: No supported key exchange algorithms [preauth]
Feb 27 11:06:03 jlOS sshd[1777]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key
Feb 27 11:06:03 jlOS sshd[1777]: error: Could not load host key: /etc/ssh/ssh_host_dsa_key
Feb 27 11:06:03 jlOS sshd[1777]: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Feb 27 11:06:03 jlOS sshd[1777]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Feb 27 11:06:03 jlOS sshd[1777]: fatal: No supported key exchange algorithms [preauth]

Thanks for your time.

Please post the output of;

ls -l /etc/ssh

If the files are all 0 bytes, well now - then we know what the problem is :stuck_out_tongue:

Those last bits about not being able to load a host key seem pretty
terrible. Do those files exist? If you restart the sshd service do they
show up?


Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below…

Looks like you’re right!

total 256-rw-r--r-- 1 root root   2375 Sep 25 03:56 ldap.conf
-rw------- 1 root root 242153 Sep 25 03:56 moduli
-rw-r--r-- 1 root root   2777 Sep 25 03:56 ssh_config
-rw-r----- 1 root root   4310 Feb 27 10:22 sshd_config
-rw------- 1 root root      0 Nov 18 16:18 ssh_host_dsa_key
-rw-r--r-- 1 root root      0 Nov 18 16:18 ssh_host_dsa_key.pub
-rw------- 1 root root      0 Nov 18 16:18 ssh_host_ecdsa_key
-rw-r--r-- 1 root root      0 Nov 18 16:18 ssh_host_ecdsa_key.pub
-rw------- 1 root root      0 Nov 18 16:18 ssh_host_ed25519_key
-rw-r--r-- 1 root root      0 Nov 18 16:18 ssh_host_ed25519_key.pub
-rw------- 1 root root      0 Nov 18 16:18 ssh_host_key
-rw-r--r-- 1 root root      0 Nov 18 16:18 ssh_host_key.pub
-rw------- 1 root root      0 Nov 18 16:18 ssh_host_rsa_key
-rw-r--r-- 1 root root      0 Nov 18 16:18 ssh_host_rsa_key.pub

I was wondering if the errors in my original post had something to do with it. How can I fix this?

Stop sshd service
Remove the 0 byte files
Start sshd

To remove all 0 byte files, for example you could use;

find /etc/ssh -size 0b -exec rm {} \;

It’ll regenerate those files when you start the sshd service.

Thank you!! I’ve been trying different things for so long and this finally worked! :slight_smile:

Next step if you’re willing: figure out and tell us what you did on
2014-11-18 that caused those file to become zero-bytes. I’ve never seen
that before, but there are reasons it could happen I suppose. The
most-likely one that comes to mind is stating sshd for the first time when
out of disk space… that might do it assuming whatever creates those
files (sshd in this case) does not detect the problem and abort early.


Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below…