automatic creation of a chroot environment

Rozhuk Ivan <[email protected]> Thu, 16 Jul 2026 04:49:11 +0300
Newsgroups gmane.os.freebsd.devel.hackers
Message-ID <[email protected]>
Hi!


I've been using chroot for a long time to reduce the risk of web application hacking on my server.

Some time ago, I decided it was time to automate the creation of chroot environments and create a universal solution for any application/port that would be easily customizable.

For simple applications and ports, it usually works with minimal effort, but for complex ones, it takes a bit more tinkering.

The current implementation creates a RO chroot, without setuid files, with one user and one group.
All RW locations are mounted with noexec and nosuid.
This makes escaping such a chroot environment extremely difficult, and webshell and other PHP hacks become impossible.

I hope someone finds this useful.

https://github.com/rozhuk-im/chroot_env