How to change the ownership of httpd process?

apache
  • The owner and group of httpd-related processes is “apache” by default, as set in the apache configuration file (httpd.conf) shown below.

User apache
Group apache

  • You can confirm the user name and group of httpd process by using the ps command as follows.

$ ps -aux | grep httpd
root 9773 0.0 0.0 4520 685 pts/3 R+ 19:19 0:00 grep --color httpd
root 9773 0.0 0.5 18564 5736 ? Ss Aug19 0:00 /usr/sbin/httpd
apache 9773 0.0 0.2 18564 3068 ? S Aug19 0:00 /usr/sbin/httpd
apache 9773 0.0 0.2 18564 3068 ? S Aug19 0:00 /usr/sbin/httpd

  • If you want to change the owner of the httpd, simply edit /etc/httpd/conf/httpd.conf and replace the User and Group directives with any other user/groupd.

User newuser
Group newgroup

  • Restart apache httpd service.

systemctl restart httpd

  • Confirm the modification as follows.

ps -aux | grep httpd

Leave a Reply