2

NOTE: I'm familiar with this U&L Q&A titled: How do I tell I'm running in a chroot? that sounds similar to what I'm asking, but there's a subtle difference to what I'm looking for. That one focuses on the process itself detecting that it's in a chrooted environment, I'm asking how one process to find out that another is chrooted.


Was looking into an apache issue in a unfamiliar server. The output of ps -ef looked like this:

[belmin@server131 ~]$ sudo ps -ef | grep httpd
apache   14363 4082  0 14:04 ?        00:00:00 /usr/local/apache2/bin/httpd -k start
apache   14365 4082  0 14:04 ?        00:00:00 /usr/local/apache2/bin/httpd -k start

I looked in /usr/local/apache2/conf for the configuration and it was not what I expected given the symptoms we were seeing. Decided to double check the init script and noticed the actual process was in a chroot jail.

For future reference, is there a way of figuring out if a process is in a chroot jail with just the PID? And how would I find out the path of the chroot jail?

1 Answers1

5

Look at /proc/<pid>/root. This is a symbolic link to the process's root directory. If it doesn't link to /, the process is in a chroot jail.

Barmar
  • 9,927