JCHROOT(8)
π JCHROOT(8) β chroot with more isolation π
okay so bestie, listen up β this is the manual page for jchroot, and it's literally about running stuff in a chroot but with way more isolation. no cap, it's giving main character energy for your containers. let's get into it. β¨
π¦ SYNOPSIS π¦
jchroot [-h | --help] [-U | --new-user-ns] [-N | --new-network-ns]
[-u | --user user] [-g | --group group] [-f | --fstab fstab]
[-n | --hostname hostname] [-M | --uid-map map]
[-G | --gid-map map] [-p | --pidfile pidfile]
[-e | --env name=value] [-c | --chdir directory]
[-b | --background] target [--] command
π DESCRIPTION π
jchroot provides a chroot to run a command or a shell with more isolation, thanks to features introduced in recent Linux kernels (2.6.24 or later). Like chroot(8), jchroot will change the root directory to the specified target before running the provided command β but it will also provide a new PID namespace, a new mount namespace and a new IPC namespace to ensure better isolation. slay. π₯
Moreover, when the command exits, the kernel will automatically kill any process that was started by the command, umount any filesystems mounted by jchroot or the command, and cleanup the IPC namespace. Therefore, most daemons can be run safely from the chroot: they will be killed on exit. periodt. π
The options are as follows:
πΈ OPTIONS πΈ
-N,--new-network-nsβ switch to a new network namespace. The program will be run in a fresh network namespace. Unless additional actions are taken, this means that the program won't get any network access. literally no wifi for you, bestie. π-U,--new-user-nsβ switch to a new user namespace. It allowsjchrootto be run without being root. It requires a recent kernel (3.8+) with support for user namespace. king behavior. π-M,--uid-mapmapping β use the provided user-mapping in the new user namespace. This option should not be used without the-Uoption. The mapping is explained inuser_namespaces(7)manual page. A mapping is a record with the ID range start inside the namespace, the ID range start outside the namespace and the length of the range. iykyk. π§-G,--gid-mapmapping β use the provided group-mapping in the new user namespace. See-Mfor more information. same vibe, different ID. π-u,--useruser β specify user to use after chrooting. This can be specified as a user name or an UID. In case of a user name, the primary group of the user is also used unless another group is specified. π-g,--groupgroup β specify primary group to use after chrooting. This can be specified as a group name or a GID. π-f,--fstabfstab β specify a file location in thefstab(5)format containing mount points relative to target to mount inside the chroot. Here is an example of such a file:
proc /proc proc defaults 0 0
sys /sys sysfs defaults 0 0
/home /home none bind,rw 0 0
/dev/pts /dev/pts none bind,rw 0 0
/var/run /var/run tmpfs rw,nosuid,noexec,mode=755 0 0
/etc/resolv.conf /etc/resolv.conf none bind,ro 0 0
-n,--hostnamename β specify a hostname for the chroot. This enables UTS namespace. cute name for your tiny kingdom. π°-p,--pidfilefile β write PID of child process to file. π-e,--envname=value β set an environment variable. This option can be specified more than once. stack 'em up. π-c,--chdirdirectory β change to the specified directory after entering the chroot. πͺ-b,--backgroundβ allow processes started byjchrootto continue in the background. Otherwise, they will be killed abruptly with aSIGKILLsignal oncejchrootterminates. Due to the use of a PID namespace, the process running as PID 1 in the chroot will only handleSIGKILLandSIGSTOPfrom an ancestor, and all other signals need a specific handler (no default handler). Therefore, when using this option and using Ctrl+C to stop a process, the process may continue the background instead of terminating. Note this option does not put the command in background by itself. β οΈ
bestie this is a little cursed β read it twice. signals get weird in PID namespaces, and Ctrl+C might not do what you expect. not a bug, just how the kernel rolls. π
-h,--helpβ get help. we love a helpful icon. π«Ά
π SEE ALSO π
β¨ AUTHORS β¨
The jchroot program was written by Vincent Bernat <bernat@luffy.cx>. iconic. π
and that's the whole vibe β go forth and chroot safely, bestie. π
this page is from the Debian project, dated August 17, 2011, for jchroot section 8 of the manual. mwah. π
π¦ where this page comes from
- alpine 3.24: jchroot-doc 1.1-r0 Β· ISC
- Copyright (c) 2011 Vincent Bernat <bernat@luffy.cx>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms