我在虚拟机上的虚拟机中运行了 ubuntu 12.04。它的存在主要是作为与 Ubuntu 一起玩的“玩具”,因此出于这个原因,我想要 GUI(这就是 ubuntu 12.04 中的“Dash”吗?无论如何......)
我目前使用这台机器的一件事是 LAMP 服务器。我使用“gedit”来编辑我的文件,但是因为我还没有正确设置权限,所以我只是在终端中使用 sudo 打开它。
刚才,为了简化这个过程,我在桌面上用一个非常简单的工作创建了一个 shell 脚本 - sudo gedit
我不禁想到必须有比这更明显的方法来从 GUI 以 root 身份打开 gedit。那么有吗?
编辑:我只是通过用 gksudo 替换 sudo 来“改进”我的脚本。现在我不必在 gedit 打开时打开终端窗口。所以我想现在这很方便:) 出于知识的考虑,知道这是否与经验丰富的 ubuntu 用户会做这种事情的方式很接近会很好。
当我运行时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.
Run Code Online (Sandbox Code Playgroud)
使用gksudo也无济于事
Cannot open display:
Run 'gedit --help' to see a full list of available command line options.
Run Code Online (Sandbox Code Playgroud)
任何帮助家伙。我需要有这种能力以 root 身份在 Gedit 中打开文件。
我发现这个问题有同样的错误,但没有解决方案Unable to launch gedit with sudo
编辑
我在Ubuntu 论坛中找到了这篇文章。
这些是说明:
我在 ubuntu 18.04 上下载了 Upwork 桌面应用程序。当我用 Gdebi 包安装程序打开它时,我看到了这个错误:
我尝试gksu通过手动安装,sudo apt install gksu但出现此错误
Building dependency tree
Reading state information... Done
Package gksu is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'gksu' has no installation candidate
Run Code Online (Sandbox Code Playgroud)
我如何在 ubuntu 18.04 上安装这个软件(我昨天下载了它,所以它是 upwork 网站上的最新版本)?
这个脚本在做什么?
#!/bin/bash
xhost +local:
xhost +si:localuser:root
Run Code Online (Sandbox Code Playgroud)
什么是默认列表xhost?
我刚刚安装了 Ubuntu 17.10。一切似乎都很好,只是我无法使用 Synaptic。我安装它(显然)没有问题,但是当我单击它的图标时,没有任何反应。
从终端尝试这是我得到的错误:
No protocol specified
Unable to init server: Could not connect: Connection refused
(synaptic:3572): Gtk-WARNING **: cannot open display:
Run Code Online (Sandbox Code Playgroud)
知道这是什么意思吗?
预先感谢您的支持。
我想知道在使用 Nautilus 2.30 时是否可以授予 root 权限?
例如,我想从主目录中移动一些长期未使用用户的旧文件夹 - 以前发行版(Debian)的残留物。
当然我可以打开一个终端,但我想知道是否可以在 Nautilus 中使用鼠标来做到这一点。
我使用 Ubuntu 17.10。
当我以 root 身份启动gedit和virt-manager 时,我收到一条可疑的错误消息:
gtk warning cannot open display :0.0
我阅读了很多帖子,但没有一个适用于 Ubuntu 17.10。
谢谢你的帮助。
我曾经在 ubuntu 17.04 上运行过wireshark
~/$ sudo wireshark
Run Code Online (Sandbox Code Playgroud)
但是现在(就在更新到 17.10 之后)当我写同样的代码时,我收到一个错误
~/$ sudo wireshark
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Invalid MIT-MAGIC-COOKIE-1 keyQXcbConnection: Could not connect to display :0
Run Code Online (Sandbox Code Playgroud) 在跑步的时候
gksu gedit /etc/udev/rules.d/somefile.rules
Run Code Online (Sandbox Code Playgroud)
我收到了这个建议。
Command 'gksu' not found, did you mean:
command 'gosu' from deb gosu
command 'ksu' from deb heimdal-clients
command 'ksu' from deb krb5-user
Try: sudo apt install <deb name>
Run Code Online (Sandbox Code Playgroud) 试图在这里找到一些答案:更新到 15.10 后无法从终端启动图形应用程序,但它没有解决我的问题。
$ sudo gedit
Failed to connect to Mir: Failed to connect to server socket: No such file or directory.
Unable to init server: Could not connect: Connection refused.
(gedit:4574): Gtk-WARNING **: cannot open display:
Run Code Online (Sandbox Code Playgroud)
只有gedit在终端工作正常。这是我的本地计算机,不是远程系统。