我正在尝试通过 MacBook 远程连接我的桌面(Ubuntu 20.04.2 LTS)。但我的请求被拒绝。所以我检查了 Ubuntu 上的 ssh 状态。
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)
它显示 ssh 服务未激活。然后我尝试手动启用它。
/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!
所以我按照它说的做。
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.
然后我检查了一下,
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.
好吧,我生成了新的密钥sudo ssh-keygen -A
,但我仍然无法启用 ssh 服务。
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.
我真的很困惑。请帮帮我!