home | about | archive | mobile | facebook | google+ | twitter | webcam | email me
chief unix engineer for an LA dotcom, convertiblist, seinfeldian logician, occasional libertine, desert-lover, englishman. inveterate monarchist.

how to tell if you’re in a chroot or not

think you might be in a skillfully-crafted chroot? feelin’ paranoid and you simply MUST KNOW?

check the inode number of the / filesystem. on every unix box, the inode number of / is always 2 (there are exceptions, but on 99.9999% of boxen, this is the case). so, if you stat(“/”) and you see an inode number that is not 2, you’re in a chroot.

howzat? if you’re in a chroot, your / is actually /some/folder/where/the/admin/made/your/chroot/start. that folder has its own inode number, like 11412635. that’s the number you’ll see because you’re really stat()ing /some/folder/where/the/admin/made/your/chroot/start, its just being presented to you as /.

because you’re in a chroot.

that is all.

4 notes

  1. ricktdotorg posted this