开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜