I wanted to find whether I am inside a chroot as part of a script where I'm not allowed to mount /proc if it is not (unlike the case in How do I tell I'm running in a chroot?). How to find whether I'm in a chroot even if /proc is not mounted?

I do have root access. This is on Fedora. The solution should not depend on the filesystems used.


Debian chroot put a specific file to /etc, but this need cooperation.

But if it is like normal root, it is like normal root. So if you don't find differences, assume that you are not in chroot (in any case it is equivalent).

The hard way is to check if / is the same as what you will get mounting the root device, but this requires you to be root. Other methods requires /proc (or root).

| improve this answer | |
  • Is there anything like /etc check available for Fedora? I can't get things mounted on / – nithinj Dec 15 '16 at 4:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.