Debian – How to change the ownership of a process in Debian

debianpermissionsprocess

I have a process of mine running as root (say a webserver) and I want it to be run as non-root.

Is there a way to change the ownership of a process from root to an unprivileged user?

I am working on a Debian machine.

Thanks!

Best Answer

There isn't any sensible universal way to change the ownership of a running process from outside that process. Processes can change their own ownership from root to non-root using setuid(2) system call. If the webserver in question is Apache, you can configure what users it runs as by editing /etc/apache2/envvars and restarting it.