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" 安装对应版本
1412 0
|
5月前
[√]addr2line
[√]addr2line
70 0
|
4月前
|
前端开发
display:contents
display:contents
23 1
|
5月前
|
Java
IDEA-解决Command line is too long. Shorten command line for SpringBootMainApplication or also for App
IDEA-解决Command line is too long. Shorten command line for SpringBootMainApplication or also for App
43 0
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
219 0
编译mate-control-center:error: required directory ./help does not exist
编译mate-control-center:error: required directory ./help does not exist
81 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?)
281 0
cannot open layout editor - how to fix error message
cannot open layout editor - how to fix error message
cannot open layout editor - how to fix error message
|
Windows
open the same code side by side with two splited windows at the same time
open the same code side by side with two splited windows at the same time
open the same code side by side with two splited windows at the same time
Busy Dialog init - hashchange will call BusyDialog.open - flower
Created by Wang, Jerry, last modified on Jun 29, 2015
91 0
Busy Dialog init - hashchange will call BusyDialog.open - flower