无法找到 SSH 服务器 - 即使已安装

Ala*_*lan 15 ssh openssh sshd

我有一台运行 Ubuntu 18.04 LTS 的机器,但我似乎无法让 SSH 服务器工作。

我使用以下命令安装了 SSHServer:

sudo apt install openssh-server
Run Code Online (Sandbox Code Playgroud)

但当我尝试启动和/或检查状态时,我收到以下信息:

sudo systemctl start sshd

Failed to start sshd.service: Unit sshd.service not found.
Run Code Online (Sandbox Code Playgroud)

sudo systemctl status sshd

Unit sshd.service could not be found.
Run Code Online (Sandbox Code Playgroud)

我想我安装时一定做错了什么(打字错误?),所以我尝试再次安装:

sudo apt install openssh-server
Run Code Online (Sandbox Code Playgroud)

我得到:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
openssh-server is already the newest version (1:7.6p1-4ubuntu0.3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Run Code Online (Sandbox Code Playgroud)

所以,看起来它已经安装了,但由于某种原因 Ubuntu 找不到它。

我不知道从这里去哪里,所以欢迎任何建议。

谢谢,

艾伦.

Nic*_*vit 20

该服务可能不名为 sshd。你可以尝试这个命令

systemctl -l --type service --all|grep ssh
Run Code Online (Sandbox Code Playgroud)

在我的 ubuntu 18.04 上,该服务默认称为 ssh。

就我而言,我做了

sudo systemctl start ssh
Run Code Online (Sandbox Code Playgroud)

如果这不能解决您的问题,您可以重新安装 ssh

sudo apt-get remove --purge openssh-server
sudo apt-get update
sudo apt-get install openssh-server
Run Code Online (Sandbox Code Playgroud)