Invoking an external script inside a chroot environment

I am using the chroot development environment to develop software for devices. The chroot dev environment isolates the rest of my system from hacking the build system. The chroot environment is text based, but I prefer to use a graphical text editor. Right now, I am holding one chrooted terminal in the dev environment to create packages, and one terminal points to the chroot environment from outside for editing files.

I am tired of constantly switching between these terminals, but I do not want to install X and Gnome in my compact developers environment for obvious reasons. I need a way to redirect certain commands to the external environment, but I cannot come up with a simple solution. How can I execute a command on an external system from a chroot environment?

+3
source share
3 answers

Yes, SSH can be used, but without forwarding X, because you want to run the application outside of chroot, and not inside. This means that you must tell the application where its X server is located, because SSH will not do this for you. This is done by setting the DISPLAY environment variable before starting any X application with the same value as your non-chrooted terminal, usually this:

export DISPLAY=:0
+1
source

You can use SSH on your own system by enabling X forwarding and configuring it with the keys, so no password is required. At a minimum, something like:

ssh localhost -c my-graphical-editor
+1
source

chrooted, , , chroot/environment. , /usr,/opt/ .. "" . .

You can personally choose a graphical interface, but is it necessary? Or rather, it would jeopardize the prison; make it easier to break out of jail?

You can quickly and quickly execute su ...

0
source

Source: https://habr.com/ru/post/1752981/


All Articles