Gtk-WARNING **: cannot open display: :0.0之解决

简介:

当使用su 到另外一个用户运行某个程序,而这个程序又要有图形显示的时候,就有可能有下面提示:

root@dt:~# sudo -i -u keji google-chrome
No protocol specified

(google-chrome:5146): Gtk-WARNING **: cannot open display: :0.0

这是因为Xserver默认情况下不允许别的用户的图形程序的图形显示在当前屏幕上. 如果需要别的用户的图形显示在当前屏幕上, 则应以当前登陆的用户, 也就是切换身份前的用户执行如下命令。

xhost +

通过执行这条命令,就授予了其它用户访问当前屏幕的权限,于是就可以以另外的用户运行需要运行的程序了










本文转自 jiu~ 博客园博客,原文链接:http://www.cnblogs.com/jiu0821/p/8407491.html,如需转载请自行联系原作者
目录
相关文章
|
Shell
xhost: unable to open display ":0.0"
-bash: xhost: 未找到命令 原因是因未没有安装相关的包(其他类似command not found命令没有可以用这种方式解决) yum whatprovides "*/xhost" 安装对应版本
1705 0
|
6月前
|
安全
qt.qpa.xcb: could not connect to display 问题解决
【5月更文挑战第16天】qt.qpa.xcb: could not connect to display qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found. This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. 问题解决
2984 0
[√]addr2line
[√]addr2line
145 0
|
11月前
|
前端开发
display:contents
display:contents
52 1
Gtk-ERROR **: 14:39:47.000: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process
Gtk-ERROR **: 14:39:47.000: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process
257 0
编译mate-control-center:error: required directory ./help does not exist
编译mate-control-center:error: required directory ./help does not exist
99 0
成功解决:Could not initialize SDL - No available video device (Did you set the DISPLAY variable?)
成功解决:Could not initialize SDL - No available video device (Did you set the DISPLAY variable?)
642 0
|
开发工具 Android开发
Error while waiting for device: The emulator process for AVD Pixel_2_XL_API_28 was killed.
Error while waiting for device: The emulator process for AVD Pixel_2_XL_API_28 was killed.
1059 0
Error while waiting for device: The emulator process for AVD Pixel_2_XL_API_28 was killed.