开发者

How can I detect I am running in a chroot() environment without being UID 0? [duplicate]

开发者 https://www.devze.com 2023-02-13 02:04 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Detecting a chroot jail from within
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Detecting a chroot jail from within

Detecting whether your process is executed in a chroot() environment on Linux is relatively easy: by comparing the device/inode of /proc/1/root and /. However, that requires access to stat() on /proc/1/root -- which is unfortunately privileged.

I am looking for a nice way to achieve the same thing, but witho开发者_如何学JAVAut requiring privileges for that. Anybody can help me? How can my unprivileged code detect whether its is being executed in a chroot() environment?


If you found one, you should report it as a bug. The whole point of chroot() is to let someone make a protected environment that doesn't give away that hint without privilege.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号