在 chroot 环境中调用外部脚本
我使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以通过 SSH 连接到您自己的系统,启用 X 转发,并使用密钥进行设置,这样就不需要密码。至少,类似:
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:
当帐户被 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...
是的,可以使用 SSH,但没有 X 转发,因为您想在 chroot 之外运行应用程序,而不是在内部。这意味着您必须告诉应用程序其 X 服务器在哪里,因为 SSH 不会为您做这件事。这是通过在运行任何 X 应用程序之前将 DISPLAY 环境变量设置为与非 chroot 终端相同的值来完成的,通常是:
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: