The chroot utility runs a process with the given directory set as the root / directory of its filesystem. There are many use cases for such a tool, e.g. to mess with a different Linux system without booting it, to run glibc software on a musl-based host, or to test examples on a fresh system.This article will not dwell on security concerns: we’ll assume the software we run is not adversiarial. If secure sandboxing is your primary interest, then further measures beyond chroot are necessary to set up a true container, e.g. namespaces and cgroups (see this blog). Containerization software such as Docker automatically manages all these aspects for you.Table of ContentsSetting up a root directorySharing kernel drivers and hardwareNetwork accessTerminal interfacesDisplay windows and audioFull script with cleanupSetting up a root directoryThe easiest way to setup a sysroot is to download a prebuilt one from a Linux distribution, e.g. the rootfs tarball from Void Linux.$ mkdir void_sysroot &&…
No comments yet. Log in to reply on the Fediverse. Comments will appear here.