当我运行时sudo gedit /path/to/some/random/file,出现以下错误  
** (gedit:6262): WARNING **: Command line `dbus-launch --autolaunch=7f8731869e1c690b8205727e0000000a --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.  
使用gksudo无济于事  
Cannot open display: 
Run 'gedit --help' to see a full list of available command line options.  
任何帮助的人。我需要具有此功能才能以root身份在Gedit中打开文件。
我发现了这个问题,但有相同的错误,但没有解决方案无法使用sudo启动gedit
编辑
 
我在Ubuntu论坛中找到了这篇文章。
这些是说明:  
- echo $ DISPLAY#您将需要此值3行
 - sudo -i#或旧版Slackwares上的“ su-”
 - xauth merge〜alien / .Xauthority#在这里使用您自己的用户名,而不是“ alien”
 - export DISPLAY =:0.0#使用您之前看过3行的DISPLAY的值
 
在执行命令3时,出现此错误
xauth:  file /root/.Xauthority does not exist  
也许这个新的信息可以揭示更多。
gksudo或gksu返回相同的错误。
                
gksudo gedit /path/to/the/file/name吗?