centos7.9Starting sshd (via systemctl):
时间: 2023-07-23 08:00:09 浏览: 60
To start the SSH service on CentOS 7.9, you can use the systemctl command. Here's the command you can run:
```
sudo systemctl start sshd
```
This command will start the OpenSSH server on your CentOS 7.9 system. Make sure to run it with root privileges using sudo.
相关问题
centos service sshd restart bash: service: command not found
如果您在 CentOS 中运行 `service sshd restart` 命令时出现 `bash: service: command not found` 的错误提示,可能是因为 CentOS 7 或更高版本已经使用了 `systemd` 进程管理器,而不再使用 `service` 命令来管理服务。
您可以使用以下命令来重启 SSH 服务:
```
systemctl restart sshd
```
请注意,您需要使用 root 用户或者具有 sudo 权限的用户来执行此命令。
-bash: systemctl: command not found
根据提供的引用内容,CentOS 6.8系统无法识别systemctl命令的原因是该版本的CentOS不支持systemctl命令。systemctl命令是CentOS 7及以上版本的系统内置命令。如果你在CentOS 6.8系统中使用systemctl命令会出现"-bash: systemctl: command not found"的错误提示。
解决这个问题的方法是使用service命令来代替systemctl命令。service命令是CentOS 6.8及以下版本的系统所支持的。
例如,如果你想启动一个名为httpd的服务,你可以使用以下命令:
```shell
service httpd start
```
如果你想停止该服务,可以使用以下命令:
```shell
service httpd stop
```
如果你想重启该服务,可以使用以下命令:
```shell
service httpd restart
```
请注意,以上命令中的httpd只是一个示例,你需要根据你实际使用的服务来替换它。