Variant for chroot ?
Variant for chroot ?
Posted Mar 13, 2026 5:25 UTC (Fri) by tamiko (subscriber, #115350)In reply to: Variant for chroot ? by wtarreau
Parent article: Practical uses for a null filesystem
It sounds like you're looking for the $ unshare helper program. Unsharing the current mount namespace and putting a child process into it has exactly the semantics you're looking for: when the child exits the namespace is removed as well.
The new nullfs mount has the advantage that you can start with a truly empty mount namespace instead of mounting over and sealing. That's at least my current understanding.
But out of curiosity: do you know "bubblewrap"? It is a fantastic helper tool to createnlightweight sandboxes via namespaces. Best of all, you can run it as an unprivileged user. And it can do all of the sandboxing you're talking about.
