Security >
Software > Linux tools >
Uses:
- Running 32bit apps in a 64bit environment.
-
A secure "jail" for software to run in and not see or touch the rest of the filesystem.
-
Wine -- I did some experimentation with a chroot in wine
Notes ∞
It's something like this:
mount --bind /dev /mnt/dev mount --bind /tmp /mnt/tmp mount -t proc proc /mnt/proc mount -t sysfs none /mnt/sys chroot /mnt /bin/bash
Other notes under Sometimes chroot only works with UID 0.
Stuff ∞
I am forced to use a 64bit Linux - I chose Lubuntu - because World of Warcraft under Wine works much better.
I, however, wanted to get back into programming in Mythryl.
As I understand, the usual way to run 32bit applications on a 64bit Ubuntu is to install ia32-libs. However, as of mid-2013 it is very very broken.
I adapted these instructions:
https://help.ubuntu.com/community/DebootstrapChroot
"Some day" people dream of making things easier:
https://wiki.ubuntu.com/BluePrints/32BitChroot
Other notes ∞
- https://www.maketecheasier.com/run-32-bit-apps-in-64-bit-linux/
-
crsh - A chroot jail wrapper for ordinary Unix shells
- Removed from the website, but archived locally.
Chroot sometimes fails ∞
- setup
su - adduser -o -u 0 chroot1 adduser chroot2 mkdir /home/chroot1/tmp-mount mkdir /home/chroot2/tmp-mount mount -o bind / /home/chroot1/tmp-mount mount -o bind / /home/chroot2/tmp-mount
- steps to reproduce
First one with UID 0
su - chroot1 -c 'chroot ./tmp-mount/'
control-d
Second one with UID non-0
su - chroot2 -c 'chroot ./tmp-mount/'
fails, with:
-bash: chroot: command not found
ok, try with this:
su - chroot2 -c '/usr/sbin/chroot ./tmp-mount/'
fails, with:
/usr/sbin/chroot: cannot change root directory to ./tmp-mount/: Operation not permitted
- teardown
su - umount /home/chroot1/tmp-mount umount /home/chroot2/tmp-mount userdel -r chroot1 userdel -r chroot2
- TODO - So how do I do what I want, when the user has UID non-0?
-
TODO - How do I change a user's UID temporarily?
Executing multiple commands inside a chroot ∞
su - -c chroot root /root/tmp-mount "$SHELL" -c ' \ echo ok ;\ # comments are ok, without the trailing semicolon-slash echo yay ;\ '
Or on one line:
su - -c chroot user /root/tmp-mount "$SHELL" -c 'echo "ok"'
I see no way to remain in the chroot after executing these commands.
Stuff ∞
Not updated in a while, abandoned:
-
- Linux 2.4 kernel module, and still requires patching. =(
- Noid chtrunk
Last updated 2021-08-07 at 09:14:15