在 CentOS 7 上,我试图调试 nginx 放大代理无法读取 /proc/$pid/io 的问题,即使它归正确的用户所有。
现在 nginx 工作进程之一是 pid 5693:
# ps aux | grep 5693
nginx 5693 0.5 0.0 129000 14120 ? S Jul18 16:10 nginx: worker process
Run Code Online (Sandbox Code Playgroud)
nginx 用户具有读取文件的权限:
# ls -lAh /proc/5693/io
-r-------- 1 nginx nginx 0 Jul 20 11:30 /proc/5693/io
Run Code Online (Sandbox Code Playgroud)
...但实际上无法阅读它:
# sudo -u nginx /bin/sh -c 'cat /proc/5693/io'
cat: /proc/5693/io: Permission denied
Run Code Online (Sandbox Code Playgroud)
...即使 selinux 被禁用:
# sestatus
SELinux status: disabled
Run Code Online (Sandbox Code Playgroud)
root 可以读取 /proc/5693/io 就好了,nginx 用户可以读取 /proc/5693 中的其他文件。似乎必须有其他一些安全机制来阻止访问,但我不知道它可能是什么。