当我使用sudo
命令运行某些软件时,它显示如下错误
cannot connect to X server
例如,如果我运行以下命令:
$ sudo gedit /etc/profile
我收到以下命令
(gedit:6758): WARNING **: Command line `dbus-launch --autolaunch=84b871d735f31ffe014dc9ba00000009 --binary-syntax --close-stderr'
exited with non-zero exit status 1:
Autolaunch error: X11 initialization failed.
Cannot open display:
Run 'gedit --help' to see a full list of available command line options.
或者,如果我正在运行,则会super-boot-manager
出现以下错误
buc: cannot connect to X server
请帮忙。
您需要允许 root 用户访问 X 服务器:
xhost local:root
并将命令指向右侧DISPLAY
:
sudo DISPLAY=$DISPLAY gedit /etc/profile
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句