Last active
January 11, 2023 23:12
-
-
Save lincerely/2a85c633db94ae46329e6c6418066db2 to your computer and use it in GitHub Desktop.
setup a virtual root environment with chroot, unshare and BusyBox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 1. setup the environment | |
| # apt install busybox-static | |
| mkdir -p test.root/bin | |
| cp /usr/bin/busybox test.root/bin # busybox must be a static binary | |
| # 2. start the virtual env (without root) | |
| unshare --map-root-user chroot test.root /bin/busybox ash | |
| # with root: chroot test.root /bin/busybox ash | |
| # 3. link busybox applets so no need to type busybox everytime | |
| # inside the busybox shell: | |
| # $ cd bin | |
| # $ /bin/busybox --install -s . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment