Detecting a chroot jail from within

后端 未结 8 705
名媛妹妹
名媛妹妹 2020-12-24 03:02

How can one detect being in a chroot jail without root privileges? Assume a standard BSD or Linux system. The best I came up with was to look at the inode value for \"/\"

8条回答
  •  旧时难觅i
    2020-12-24 03:28

    The inode for / will always be 2 if it's the root directory of a filesystem, but you may be chrooted inside a complete filesystem. If it's just chroot (and not some other virtualization), you could run mount and compare the mounted filesystems against what you see. Verify that every mount point has inode 2.

提交回复
热议问题