# User directive warning, despite being run as root

**URL:** <https://www.ruby-forum.com/t/user-directive-warning-despite-being-run-as-root/206074>\
**Category:** NGINX\
**Created:** [April 21, 2011, 8:31pm UTC](https://www.ruby-forum.com/t/user-directive-warning-despite-being-run-as-root/206074 "2011-04-21T20:31:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [April 21, 2011, 8:31pm UTC](https://www.ruby-forum.com/t/user-directive-warning-despite-being-run-as-root/206074/1 "2011-04-21T20:31:22Z")

</div>

I’m running nginx 1.0.0 on a MacOS X machine, installed with brew, and  
when I launch nginx, even with sudo, I get the following warning in my  
log file over and over again:

4/21/11 2:03:42 AM org.nginx[3788] nginx: [warn] the “user” directive  
makes sense only if the master process runs with super-user privileges,  
ignored in /usr/local/etc/nginx/conf/nginx.conf:2

> From nginx.conf:

user jschuur staff;

I’m already launching nginx with sudo, since I want the thing to listen  
on port 80. Shouldn’t that be enough to give it the proper super user  
privileges?

Running ‘sudo id’ confirms the effective UID is 0 and from nginx.c in  
the source, it does a ‘if (geteuid() != 0)’ before the error message in  
question.

The nginx binary as it’s installed:

drwxr-xr-x 3 jschuur staff 102 Apr 12 20:53 .  
drwxrwxr-x 15 jschuur staff 510 Apr 12 15:25 …  
-rwxr-xr-x 1 jschuur staff 2325648 Apr 12 20:39 nginx

FWIW, I recompiled the binary to set passenger up and moved it around  
from it’s original location into /usr/local/sbin.

Posted at Nginx Forum:

> **[User directive warning, despite being run as root](https://forum.nginx.org/read.php?2,192872,192872#msg-192872)**
>
> I'm running nginx 1.0.0 on a MacOS X machine, installed with brew, and when I launch nginx, even with sudo, I get the following warning in my log file over and over again: 4/21/11 2:03:42 AM org.nginx\[3788\] nginx: \[warn\] the "user"...

---

<div class="post-metadata">

**Author:** ![jschuur](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9fc29f/32.png) [@jschuur](https://www.ruby-forum.com/u/jschuur)\
**Post date:** [April 21, 2011, 9:06pm UTC](https://www.ruby-forum.com/t/user-directive-warning-despite-being-run-as-root/206074/2 "2011-04-21T21:06:33Z")

</div>

Some additional info here and I think I’ve clarified that this isn’t an  
nginx codebase issue: After a ‘sudo nginx -s quit’ and confirming that  
no more nginx processes were running or local web sites could be  
accessed, I was still seeing entries to the log file made, both warning  
me about the user directive and another permission issue:

2011/04/21 11:50:45 [emerg] 34505#0: bind() to 0.0.0.0:80 failed (13:  
Permission denied)

I wasn’t sure what else could be writing to the nginx log file  
directory, since neither the Activity Monitor nor ‘ps -ax | grep nginx’  
showed any nginx process running.

Then I looked at the org.nginx.plist LaunchAgent that starts up nginx  
and saw that it had KeepAlive set to true, suggesting it was in charge  
of restarting nginx. I guess I was mistaken in the ps option I used to  
find all processes. The relaunch probably happened under a different  
user ID, generating the errors.

I’ll take things up with the author of this plist (which came with  
brew).

Posted at Nginx Forum:

> **[Re: User directive warning, despite being run as root](https://forum.nginx.org/read.php?2,192872,192886#msg-192886)**
>
> I'm running nginx 1.0.0 on a MacOS X machine, installed with brew, and when I launch nginx, even with sudo, I get the following warning in my log file over and over again: 4/21/11 2:03:42 AM org.nginx\[3788\] nginx: \[warn\] the "user"...

---

<div class="post-metadata">

**Author:** ![jschuur](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9fc29f/32.png) [@jschuur](https://www.ruby-forum.com/u/jschuur)\
**Post date:** [April 21, 2011, 10:00pm UTC](https://www.ruby-forum.com/t/user-directive-warning-despite-being-run-as-root/206074/3 "2011-04-21T22:00:54Z")

</div>

One final update, incase anyone else runs across this issue: The problem  
boiled down to the launchd script in question being installed into the  
~/Library/LaunchAgents directory. Because config files from the user’s  
own LaunchAgent directory will cause the process to be run under that  
user’s ID and not root, every 10 seconds an attempt was made to restart  
nginx, and it failed, writing to the same error log that my manual  
restarts from the command line with sudo did. I was mistaking them for  
something generated by my sudo commands.

I never saw the extra nginx processes, because they exited out too fast  
for me to catch them.

Posted at Nginx Forum:

> **[Re: User directive warning, despite being run as root](https://forum.nginx.org/read.php?2,192872,192910#msg-192910)**
>
> I'm running nginx 1.0.0 on a MacOS X machine, installed with brew, and when I launch nginx, even with sudo, I get the following warning in my log file over and over again: 4/21/11 2:03:42 AM org.nginx\[3788\] nginx: \[warn\] the "user"...
