Ask HN: How can I find or identify all chrooted directories in Linux? - finid
======
LeoSolaris
All you do is escape the "jail" and ls -r the whole system. Chroot is a shell
trick that basically creates an alias for / pointing at an arbitrary folder.
Any process that is spawned in that aliased environment have the folder
returned as /. (Chroot "jails" are pretty easy to break out of, by the way,
and is not a security measure.)

I don't know if there is a way to force arbitrary running processes to output
their root directories in such a way that would link to the aliased folder.

That question is somewhat like asking if there is a way to show which folders
your shell was in for every time you've called sudo.

~~~
finid
I'm not trying to break out of any jail, just how to identify what directories
are chrooted on a Linux system. I don't see how _ls -r_ helps me out there.

------
wahern
Simple:

    
    
      $ for F in /proc/*/root; do readlink "$F"; done
    

If you need something you can cut+paste:

    
    
      $ sudo sh -c 'for F in /proc/*/root; do readlink "$F"; done' | sort -u

