Run X Window System program from chroot: Difference between revisions

From SlackWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:


<pre>
<pre>
#shell comments preceded with hash/pound sign
# shell comments preceded with hash/pound sign
xhost +localhost
xhost +localhost
su -
su -
DISPLAY=:0 #for security try to be more specific like 0:0
DISPLAY=:0 # For security try to be more specific like 0:0.
chroot chroot-stable
chroot chroot-stable
su - user
su - user
xedit #or whatever X program</pre>
xedit # or whatever X program</pre>


If you want to do this for any local area network (LAN) users omit 'localhost'.
If you want to do this for any local area network (LAN) users omit 'localhost'.

Revision as of 06:29, 6 September 2025

This is how to run about any X Window System program from another GNU/Linux chroot (whether partition or within Slackware or some others). This example uses a 'chroot-stable' Slackware-stable directory/folder (such as in Slackware-current) and example to run xedit (replace that line with whatever X program you want). The setup is you login as root ('su -') then chroot into the chroot directory's/folder's root account and then use another user. If desired you can mount something such as /home first (similar to 'mount --rbind /home /root/chroot-stable/home' or replace /root with wherever) but keep in mind if you need to delete the chroot, you don't want /home mounted inside it! Also you should possibly/likely change 'DISPLAY=:0' to 'DISPLAY=0:0' or whatever $DISPLAY number of the terminal you're using, or users on any terminal can access it. If you're the only user of your computer, you won't likely need to (unless connected to network or paranoid) but if you later run a program in a different terminal that may not work without having $DISPLAY set to correct number.

# shell comments preceded with hash/pound sign
xhost +localhost
su -
DISPLAY=:0 # For security try to be more specific like 0:0.
chroot chroot-stable
su - user
xedit # or whatever X program

If you want to do this for any local area network (LAN) users omit 'localhost'.