如何确定 BIND 正在 chroot 下运行

如何确定 BIND 正在 chroot 下运行

我正在尝试在 Ubuntu 和 CentOS 上的 chroot 下运行 BIND。在 CentOS 上安装它非常简单,只需安装软件包 - bind 和 bind-chroot,而 Ubuntu 则稍微复杂一些。

我一直按照以下链接在 Ubuntu 上运行它,

https://help.ubuntu.com/community/BIND9ServerHowto

http://www.tokiwinter.com/installing-chrooted-bind-ubuntu-12-04-server/

我可以启动并运行它,但我无法确定 BIND 是否在 chroot 中运行。

据我所知,它没有在 chroot 中运行,因为 chroot 目录中没有 pid 文件,但 /var/run/named 目录中仍有一个 pid 文件。

还尝试使用以下命令查看进程目录的映射位置

[root@centos-test etc]# ls -ld /proc/2839/root
lrwxrwxrwx. 1 named named 0 Feb 11 04:01 /proc/2839/root -> /
[root@centos-test etc]# 

但是从我在各个地方读到的内容来看,如果上述命令在监狱内运行,它应该指向 chroot 目录。

我如何才能准确识别我是否处于 chroot jail 内?

答案1

很简单:如果named使用标志运行-t <directory>,则说明它已被 chrooted。否则,则不是。

相关内容