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" 安装对应版本
1749 0
|
4月前
解决QT中报错xxx.h:4:10: ‘QMainWindow‘ file not found
解决QT中报错xxx.h:4:10: ‘QMainWindow‘ file not found
209 0
|
Java 开发工具 Android开发
Android Studio 解决:error adding symbols: File in wrong format clang++.exe: error: linker command...
错误日志: Error:FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:externalNativeBuildDebug'.
6572 0
|
7月前
|
安全
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. 问题解决
3544 1
|
6月前
|
Windows
Qtdesigner报错:This application failed to stat could not find or load the Qt platform plugin “windows“
Qtdesigner报错:This application failed to stat could not find or load the Qt platform plugin “windows“
[√]addr2line
[√]addr2line
161 0
|
TensorFlow 算法框架/工具 Python
成功解决File "frozen importlib._bootstrap", line 219, in _call_with_frames_removed ImportError: DLL lo
成功解决File "frozen importlib._bootstrap", line 219, in _call_with_frames_removed ImportError: DLL lo
成功解决File "frozen importlib._bootstrap", line 219, in _call_with_frames_removed ImportError: DLL lo
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
263 0