┌┐┌┌─┐╦═╗╔═╗╔═╗╔╦╗ │││└─┐╠╦╝║ ║║ ║ ║ ┘└┘└─┘╩╚═╚═╝╚═╝ ╩
chroot
, mount --bind
without privilege
Options:
- Use github release asset (x86_64, built with musl-gcc)
- Compile from source
- Prerequisites
git
cmake
make
orninja
- Steps
git clone https://github.com/CodeHz/nsroot.git cd nsroot mkdir build && cd build cmake .. && cmake --build . && sudo cmake --build . --target install
- Prerequisites
nsroot [-x] [-X] [-p] [-f] [-r root] [-b dir[:target]] [-t target[:options]] [-c target] [-w workdir] /path/to/program [...args]
-x
Setup user & mount namespace.-X
Setup mount namespace.-p
Mount proc filesystem.-f
Fork before exec.-r path
Use path as the new guest root file-system, default is/
.-b path
Make the content of path accessible in the guest rootfs.-t path
Create tmpfs on path in guest rootfs.-c path
Create folder structure in guest rootfs.-w path
Set the initial working directory to path.-a appname
Set the initial process name.