ssh服务已经安装了,Unit sshd.service could not be found.错误
时间: 2024-05-13 15:16:13 浏览: 26
这个错误可能是因为你的系统没有安装OpenSSH Server,或者是安装了但是服务名不是sshd。你可以尝试以下几个步骤:
1. 确认OpenSSH Server已经安装,如果没有安装,可以使用以下命令安装:
```
sudo apt-get update
sudo apt-get install openssh-server
```
2. 如果OpenSSH Server已经安装,但是服务名不是sshd,可以使用以下命令来查看正确的服务名:
```
systemctl list-unit-files | grep ssh
```
然后根据输出的结果来确定正确的服务名,并使用以下命令启动服务:
```
sudo systemctl start <correct-ssh-service-name>
```
如果服务启动成功,可以使用以下命令将服务设置为开机启动:
```
sudo systemctl enable <correct-ssh-service-name>
```
例如,如果正确的服务名是ssh,那么命令应该是:
```
sudo systemctl enable ssh
```
希望以上方法能够帮助你解决问题。
相关问题
Unit sshd.service could not be found.错误
这个错误通常是因为 sshd 服务没有安装或者没有启动。你可以按照以下步骤来解决这个问题:
1. 检查 sshd 服务是否已经安装。在大多数 Linux 发行版中,您可以使用以下命令来安装 sshd:
```
sudo apt-get install openssh-server
```
2. 启动 sshd 服务。在大多数 Linux 发行版中,您可以使用以下命令来启动 sshd:
```
sudo systemctl start sshd
```
3. 检查 sshd 服务是否正在运行。在大多数 Linux 发行版中,您可以使用以下命令来检查 sshd 服务是否正在运行:
```
sudo systemctl status sshd
```
如果 sshd 服务正在运行,您应该会看到类似于以下内容的输出:
```
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2021-09-14 10:55:35 EDT; 2h 14min ago
Docs: man:sshd(8)
man:sshd_config(5)
Main PID: 1234 (sshd)
Tasks: 1 (limit: 4915)
Memory: 5.5M
CGroup: /system.slice/sshd.service
└─1234 /usr/sbin/sshd -D
```
如果 sshd 服务没有运行,您可以使用以下命令来启动它:
```
sudo systemctl start sshd
```
希望这些步骤可以帮助您解决问题。
Unit sshd.service could not be found.
The error message "Unit sshd.service could not be found" typically indicates that the OpenSSH server package is not installed on your system or the service has not been properly enabled.
To resolve this error, you can try installing the OpenSSH server package by running the following command:
```
sudo apt-get install openssh-server
```
Once the package is installed, you can then enable and start the SSH service using the following commands:
```
sudo systemctl enable ssh
sudo systemctl start ssh
```
This should resolve the error and allow you to connect to your system using SSH.