# Bug - auto/unix incorrectly detects nobody group

**URL:** <https://www.ruby-forum.com/t/bug-auto-unix-incorrectly-detects-nobody-group/209374>\
**Category:** NGINX\
**Created:** [July 12, 2011, 9:54pm UTC](https://www.ruby-forum.com/t/bug-auto-unix-incorrectly-detects-nobody-group/209374 "2011-07-12T21:54:03Z")\
**Posts on this page:** 2\
**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:** [July 12, 2011, 9:54pm UTC](https://www.ruby-forum.com/t/bug-auto-unix-incorrectly-detects-nobody-group/209374/1 "2011-07-12T21:54:03Z")

</div>

In auto/unix (line 9 in 1.0.4) the pattern for detecting the nobody  
group is not anchored properly and will incorrectly detect the group  
nobody if the nobody user is in one of the listed groups. E.G. if  
“nagcmd:x:114:nagios,nobody” appears in the file.

This is easily fixed by anchoring the grep regex to the beginning of the  
line:

```
    if grep ^nobody /etc/group 2>&1 >/dev/null; then

```

Sean C.

Posted at Nginx Forum:

> **[Bug - auto/unix incorrectly detects nobody group](https://forum.nginx.org/read.php?2,212302,212302#msg-212302)**
>
> In auto/unix (line 9 in 1.0.4) the pattern for detecting the nobody group is not anchored properly and will incorrectly detect the group nobody if the nobody user is in one of the listed groups. E.G. if "nagcmd:x:114:nagios,nobody" appears...

---

<div class="post-metadata">

**Author:** ![scarley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/eada6e/32.png) [@scarley](https://www.ruby-forum.com/u/scarley)\
**Post date:** [July 12, 2011, 11:12pm UTC](https://www.ruby-forum.com/t/bug-auto-unix-incorrectly-detects-nobody-group/209374/2 "2011-07-12T23:12:32Z")

</div>

Hello!

On Tue, Jul 12, 2011 at 03:53:10PM -0400, scarley wrote:

> In auto/unix (line 9 in 1.0.4) the pattern for detecting the nobody  
> group is not anchored properly and will incorrectly detect the group  
> nobody if the nobody user is in one of the listed groups. E.G. if  
> “nagcmd:x:114:nagios,nobody” appears in the file.
> 
> This is easily fixed by anchoring the grep regex to the beginning of the  
> line:
> 
> ```
> if grep ^nobody /etc/group 2>&1 >/dev/null; then
> 
> ```

Yes, thank you for report.

I wonder if it’s feasible to use “id -gn nobody” instead to find  
out nobody’s group, it seems to be POSIX-complaint way to do this.  
Quck test suggests that at least current FreeBSD, Linux and QNX  
are able to handle this…

Maxim D.
