centos ssh 使用systemctl报错:Failed to get D-Bus connection: Operation not permitted
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos ssh 使用systemctl报错:Failed to get D-Bus connection: Operation not permitted相关的知识,希望对你有一定的参考价值。
参考技术A 使用centos官网docker镜像,版本为 CentOS Linux release 7.4.1708 (Core)使用systemctl报错: Failed to get D-Bus connection: Operation not permitted
centos docker镜像官网中已经说明,在centos7.2会解决这个问题,但是需要自己去开启.
解决方案.
docker run --privileged -dti -v /sys/fs/cgroup:/sys/fs/cgroup:ro -p 20022:20022 local/centos_ssh
WSL中使用systemctl报错问题
Windows10里面自带的wsl中安装docker后不支持systemctl命令。需要更换命令,用Sysvinit
的命令代替systemd,命令如下:
Systemd command | Sysvinit command |
systemctl start service_name | service service_name start |
systemctl stop service_name | service service_name stop |
systemctl restart service_name | service service_name restart |
systemctl status service_name | service service_name status |
systemctl enable service_name | service service_name on |
systemctl disable service_name | service service_name off |
以上是关于centos ssh 使用systemctl报错:Failed to get D-Bus connection: Operation not permitted的主要内容,如果未能解决你的问题,请参考以下文章
Docker的centos镜像内无法使用systemctl命令的解决办法
WSL的CentOS7报错Failed to get D-Bus connection: Operation not permitted解决办法
阿里云报错Redirecting to /bin/systemctl restart sshd.service