What is the best way for the process to determine that it runs in jail?

Kristof Provost kp at freebsd.org
Sun Jul 7 01:05:32 UTC 2019


On 2019-07-06 17:43:26 (-0700), Yuri <yuri at rawbw.com> wrote:
> I found online that it is possible to stat the root folder and find its 
> inode number.
> 
> The inode number is 2 when the root is on UFS, and 4 if the root is on ZFS.
> 
> This looks pretty hackish to me. Is this reliable?
> 
It's possible for a jail to use the root file system, so no.

> Is there a better/best way?
> 
sysctl security.jail.jailed

Kristof


More information about the freebsd-hackers mailing list