centos 6.9 sudo systemctl
时间: 2023-08-29 22:11:28 浏览: 208
CentOS 6.9 does not support the `systemctl` command, as it uses the init system called `sysvinit` instead of `systemd`. In CentOS 6.9, you can start, stop, and restart services using the `service` command. For example:
To start a service:
```
sudo service servicename start
```
To stop a service:
```
sudo service servicename stop
```
To restart a service:
```
sudo service servicename restart
```
Replace `servicename` with the actual name of the service you want to manage.
相关问题
centos尝试sudo systemctl start sshd后,出现错误 Failed to get D-Bus connection: Operation not permitted
如果在 CentOS 上尝试启动 SSH 服务 (`sshd`) 时出现 `Failed to get D-Bus connection: Operation not permitted` 错误,可能是因为您正在以非特权用户的身份尝试启动服务。
请尝试使用 `sudo` 命令以管理员身份启动服务,例如:
```
sudo systemctl start sshd
```
如果您仍然收到相同的错误,请尝试使用以下命令手动启动 SSH 服务:
```
sudo /usr/sbin/sshd -D
```
这将启动 SSH 服务,并使其在前台运行。您可以使用 `Ctrl + C` 组合键来停止服务。
如果以上方法无法解决问题,可能是系统中的 D-Bus 服务出现了问题。您可以尝试重新启动 D-Bus 服务,例如:
```
sudo systemctl restart dbus
```
然后再尝试启动 SSH 服务。
centos7输入sudo systemctl stop firewalld 没任何反应
如果在CentOS 7上输入`sudo systemctl stop firewal`命令没有任何反,可能是由于原因之一:
1 防火墙服务已停止:首先,请防火墙服务是否经处于停止。你可以使用`sudo status firewalld`令来检查服务的状态。如果服务已经止,那么输入`sudo systemctl stop firewalld`命令将没有任何反应。
2. 权限问题:如果你使用的是非root用户执行`sudo systemctl stop firewalld`命令,可能会遇到权限问题。请确保你有足够的权限来执行该命令。
3. 防火墙服务异常:如果防火墙服务本身存在异常,可能会导致无法停止。你可以尝试重启系统,然后再次尝试停止防火墙。
如果以上方法都没有解决问题,你可以尝试使用以下命令暂时禁用防火墙:
```
sudo systemctl disable firewalld # 禁用防火墙服务,使其在系统启动时不会自动启动
sudo systemctl mask --now firewalld # 禁用并屏蔽防火墙服务
```
请注意,禁用防火墙会增加系统的安全风险。在禁用防火墙之前,请确保你已经采取了其他适当的安全措施来保护你的系统。
阅读全文
相关推荐
















