为什么在 ps -aux 中 httpd 以 root 身份运行而其余部分以 apache 身份运行?

Mug*_*hil 2 http

当我执行 ps -aux 时,为什么我有一份 httpd 以 root 身份运行,其余的以 apache 身份运行?

ps -aux | grep httpd
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
root      2820  0.0  1.1 126740 13372 ?        Ss   10:23   0:00 /usr/sbin/httpd
apache    2822  0.0  0.5 126804  6456 ?        S    10:23   0:00 /usr/sbin/httpd
apache    2823  0.0  0.5 126804  6456 ?        S    10:23   0:00 /usr/sbin/httpd
apache    2824  0.0  0.5 126804  6456 ?        S    10:23   0:00 /usr/sbin/httpd
apache    2825  0.0  0.5 126804  6460 ?        S    10:23   0:00 /usr/sbin/httpd
apache    2826  0.0  0.5 126804  6460 ?        S    10:23   0:00 /usr/sbin/httpd
apache    2827  0.0  0.5 126740  6272 ?        S    10:23   0:00 /usr/sbin/httpd
apache    2828  0.0  0.5 126740  6276 ?        S    10:23   0:00 /usr/sbin/httpd
apache    2829  0.0  0.5 126740  6276 ?        S    10:23   0:00 /usr/sbin/httpd
root      3505  0.0  0.0   5460   744 pts/0    R+   11:27   0:00 grep httpd
Run Code Online (Sandbox Code Playgroud)

lar*_*sks 6

因为您的 Apache 配置包括:

User apache
Run Code Online (Sandbox Code Playgroud)

Apache 需要是 root 才能绑定到低编号端口(例如 80 和 443)。端口打开后,Apache 将更改为权限较低的用户,以便在安全受到损害时限制对系统的访问。