用 sudo 执行命令时,出现 cannot open display
为了安全起见,一般登入 Linux 时都不会使用 root 权限,在普通用户的权限下要想以 root 权限执行命令就只需要在命令前面加上 sudo 就可以了。
如果执行的是个控制台界面的程序,当然不会有什么问题。可如果是个 GUI 界面的程序呢?比如想要执行 ethereal,输入的命令就是 sudo ethereal,可能就会遇到这样的出错提示:
Gtk-WARNING **: cannot open display:
或者是
connection to ":0.0" refused by server
原因就是你登入系统后 X 不允许除了你自己之外的其他用户来连接,包括 root。
解决办法:执行命令
xhost +local:root
来把 root 用户添加到允许的列表内,再次执行 sudo ethereal 就 OK 了。
再次执行命令
xhost -local:root
就可以把 root 用户从允许列表里删除
Comments
It is difficult to make a man miserable while he feels worthy of himself and claims kindred to the great God who made him.
Posted by: schulferien niedersachsen 2012 | December 11, 2011 1:51 AM
Hi sounds good about your information. is it possible to obtain registar email id of facebook account. i have facebook user id. but how to locate facebook user id registart email id. if you can guide regarding this . it will likely be quite helpful
Posted by: Tijuana Mcfeeters | May 10, 2012 12:13 PM