1

I am trying to remote connet my desktop(Ubuntu 20.04.2 LTS) via MacBook. But my request is rejected. So I check my ssh status on Ubuntu.

sightvanish@SVPC:~$ sudo systemctl status ssh
● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; disabled; vendor preset: enabled)
     Active: inactive (dead)
       Docs: man:sshd(8)
             man:sshd_config(5)

It shows ssh service is inactive. Then I try to enable it manually.

/etc/init.d/ssh start
Starting ssh (via systemctl): ssh.serviceJob for ssh.service failed because the control process exited with error code.
See "systemctl status ssh.service" and "journalctl -xe" for details.
 failed!

So I do what it says.

sightvanish@SVPC:~$ systemctl status ssh.service
● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; disabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2021-09-10 11:38:27 CST; 21min ago
       Docs: man:sshd(8)
             man:sshd_config(5)
    Process: 13329 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=1/FAILURE)

9月 10 11:38:27 SVPC systemd[1]: ssh.service: Scheduled restart job, restart counter is at 5.
9月 10 11:38:27 SVPC systemd[1]: Stopped OpenBSD Secure Shell server.
9月 10 11:38:27 SVPC systemd[1]: ssh.service: Start request repeated too quickly.
9月 10 11:38:27 SVPC systemd[1]: ssh.service: Failed with result 'exit-code'.
9月 10 11:38:27 SVPC systemd[1]: Failed to start OpenBSD Secure Shell server.

Then I check it,

sightvanish@SVPC:~$ sshd -t
/etc/ssh/sshd_config line 5: Deprecated option ServerKeyBits
/etc/ssh/sshd_config line 7: Deprecated option KeyRegenerationInterval
/etc/ssh/sshd_config line 16: Deprecated option RhostsAuthentication
/etc/ssh/sshd_config line 17: Deprecated option RhostsRSAAuthentication
/etc/ssh/sshd_config line 18: Deprecated option RSAAuthentication
Unable to load host key: /etc/ssh/ssh_host_key
sshd: no hostkeys available -- exiting.

Well, I generate new key sudo ssh-keygen -A But I still cannot enable ssh service.

sightvanish@SVPC:/etc/ssh$ sudo service ssh start
Job for ssh.service failed because the control process exited with error code.
See "systemctl status ssh.service" and "journalctl -xe" for details.

I am really confused. Please help me!

5
  • A couple of questions: (1) have you connected to this computer in the past over SSH? (2) have you verified that ufw is allowing the connection?
    – matigo
    Sep 10, 2021 at 4:47
  • for sshd -t, try sudo sshd -t. Host keys in /etc/ssh should only be readable by root. Then try sudo /usr/sbin/sshd -ddd -- this will output a lot of debug messages. Sep 10, 2021 at 6:03
  • could also try sudo systemctl reset-failed sshd , sudo systemctl enable sshd , sudo systemctl start sshd Sep 10, 2021 at 6:06
  • If all else fails, I guess that purging the openssh-server package (purging, to remove all configuration), then optionally removing sshd_config and all ssh_host_*_key* files from /etc/ssh (if they are left there) then reinstalling it (which should install the default config and generate new host keys from scratch) should help.
    – raj
    Sep 10, 2021 at 8:06
  • Does this answer your question? SSH Server stops working after reboot, caused by missing /var/run/sshd
    – pa4080
    Sep 10, 2021 at 9:31

0

You must log in to answer this question.

Browse other questions tagged .