Cannot enable ssh service on Ubuntu 20.04

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 -ABut 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 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like