检查执行apache服务器的用户

root@ip-172-31-38-0:/var/www# ps aux | egrep '(apache|httpd)' root 1086 0.0 0.3 88480 3160 ? Ss Mar08 0:09 /usr/sbin/apache2 -k start www-data 1089 0.0 0.8 445500 8840 ? Sl Mar08 0:56 /usr/sbin/apache2 -k start www-data 1090 0.0 0.8 445564 8832 ? Sl Mar08 0:56 /usr/sbin/apache2 -k start root 12072 0.0 0.0 8160 932 pts/0 S+ 19:20 0:00 egrep --color=auto (apache|httpd) 

可以sum1请告知root运行的1086 apache进程。 这是安全问题吗?

不,这很正常。 在基于Debian的系统上,apache2以root身份启动。 然后它会在非特权用户(通常是www-data )下运行并运行。 实际工作由这些过程完成。

只有特权进程才能绑定到1024以下的端口。因此,至少对于绑定到默认的80和443端口,它必须以root身份运行。

而且,除其他外,原始进程读取SSL证书私钥,这些私钥通常仅由root读取。 来自/usr/share/doc/apache2/README.Debian.gz

 The SSL key file should only be readable by root; the certificate file may be globally readable. These files are read by the Apache parent process which runs as root, and it is therefore not necessary to make the files readable by the www-data user. 

所以,这是记录在案的行为。

没有.Apache总是以“root”身份启动,然后使用“setuid”来生成实际处理apache用户请求的子项。

如果要在特权端口上创建侦听套接字(因此在端口1024下方创建一个),则必须以root身份执行(或更准确地说:使用用户ID 0)。 SSL的端口80和443。

所以…如果您不相信Apache绑定到套接字,则不应在服务器上运行Web服务器。

例如参见http://www.thegeekstuff.com/2011/03/apache-hardening/