Application in chroot

Running X Application inside chroot environment

$ export CHROOT_ENV=/mnt

mount /proc and /sys files for chrooted environment:

$ mount –bind /dev/ $CHROOT_ENV/dev/
$ mount –bind /proc/ $CHROOT_ENV/proc/
$ mount –bind /sys/ $CHROOT_ENV/sys/
$ mount –bind /tmp/ $CHROOT_ENV/tmp/

# Let our host X accept connections from all local clients
$ xhost +
$ cp ~/.Xauthority $CHROOT_ENV/root/
$ cp ~/.ICEauthority $CHROOT_ENV/root/

$ export TERM=”xterm”
$ export SHELL=”/bin/bash”
$ export USER=”root”
$ export USERNAME=”root”
$ export PATH=”/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin”
$ export PWD=”/”
$ export SHLVL=”1″
$ export HOME=”/root”
$ export LOGNAME=”root”
$ export DISPLAY=”:0″
$ export XAUTHORITY=”$HOME/.Xauthority”
$ export COLORTERM=”$TERM”

$ chroot “$CHROOT_ENV” /bin/bash -i

$ firefox &; xmms &

Leave a Reply

Your email address will not be published. Required fields are marked *

*