Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Jul 2019 03:05:27 +0200
From:      Kristof Provost <kp@freebsd.org>
To:        Yuri <yuri@rawbw.com>
Cc:        Freebsd hackers list <freebsd-hackers@freebsd.org>
Subject:   Re: What is the best way for the process to determine that it runs in jail?
Message-ID:  <20190707010526.GD10541@vega.codepro.be>
In-Reply-To: <bafb7230-6e18-39d6-3ba4-ec3f7fac1cb1@rawbw.com>
References:  <bafb7230-6e18-39d6-3ba4-ec3f7fac1cb1@rawbw.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2019-07-06 17:43:26 (-0700), Yuri <yuri@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190707010526.GD10541>