Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


share|improve this question

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.

share|improve this answer

as webservers needs to listen at port 80 or 443 it needs to start as root to bind to those ports. If the program itself doesn't support running as non root user, you can't force it to.

The alternative is to make it listen on port greater than 1024 and redirect traffic using iptables but it's highly "hackish".

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.