在 chroot 环境中调用外部脚本

发布于 2024-09-08 06:15:09 字数 278 浏览 11 评论 0原文

我使用 chroot 开发环境来开发设备软件。 chroot 开发环境将我的系统的其余部分与我的构建系统黑客隔离。 chroot 环境是基于文本的,但我更喜欢使用图形文本编辑器。现在,我将一个终端 chroot 到开发环境中以构建软件包,并让一个终端从外部指向 chroot 环境以编辑文件。

我厌倦了在这些终端之间不断地来回切换,但出于显而易见的原因,我不想在我的紧凑开发环境中安装 X 和 Gnome。我需要一种方法将某些命令转发到外部环境,但我想不出一个简单的解决方案。如何从 chroot 环境中在外部系统上执行命令?

I use a chroot development environment for developing software for devices. The chroot dev environment isolates the rest of my system from my build-system hacking. The chroot environment is text-based, but I prefer to use a graphical text editor. Right now, I keep one terminal chrooted into the dev environment to build packages and one terminal pointed at the chroot environment from the outside to edit files.

I'm tired of constantly switching back and forth between these terminals, but I don't want to install X and Gnome on my compact dev environment for obvious reasons. I need a way to forward certain commands to the exterior environment, but I can't think of a simple solution. How can I execute a command on the exterior system from within a chroot environment?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

合约呢 2024-09-15 06:15:10

您可以通过 SSH 连接到您自己的系统,启用 X 转发,并使用密钥进行设置,这样就不需要密码。至少,类似:

ssh localhost -c my-graphical-editor

You could SSH into your own system, enabling X forwarding, and set it up with keys so no password is required. At minimum, something like:

ssh localhost -c my-graphical-editor
无声静候 2024-09-15 06:15:10

当帐户被 chroot 后,您需要的所有内容都必须存在于 chroot / 环境中。这意味着 /usr、/opt/ 等必须是“本地”的,并填充所需的任何代码。图形界面通常需要大量支持代码。

您个人可能更喜欢图形界面,但有必要吗?或者更准确地说,它会危及监狱;更容易越狱吗?

你可以很快地来回...

When an account is chrooted, everything that you need has to exist in the chroot / environment. That means /usr, /opt/, etc., has to be "local" and populated with whatever code is required. Graphical interfaces typically require a boatload of support code.

You may personally prefer a graphical interface but is it necessary? Or more correctly will it compromise the jail; make it easier to break out of jail?

You can su back and forth pretty quickly...

∞觅青森が 2024-09-15 06:15:09

是的,可以使用 SSH,但没有 X 转发,因为您想在 chroot 之外运行应用程序,而不是在内部。这意味着您必须告诉应用程序其 X 服务器在哪里,因为 SSH 不会为您做这件事。这是通过在运行任何 X 应用程序之前将 DISPLAY 环境变量设置为与非 chroot 终端相同的值来完成的,通常是:

export DISPLAY=:0

Yes, SSH can be used, but without X forwarding, because you want to run the app outside of chroot, not inside. This means you have to tell the app where is its X server, because SSH won't do it for you. It is done by setting DISPLAY environment variable prior running any X app to the same value as your non-chrooted terminal has, usually it is:

export DISPLAY=:0
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文