[Mongrel] OSX requires sudo for using ports < 1024

Zed A. Shaw zedshaw at zedshaw.com
Thu Nov 16 16:08:11 EST 2006

On Thu, 16 Nov 2006 12:37:16 -0500
"Matt Pelletier" <eastmedianyc at gmail.com> wrote:

> I assume some of you have run into this error before when trying to run
> mongrel on port 80 (or another port < 1024) in OSX:
> Mongrel runs without sudo on all other ports > 1024 otherwise. Anyone have
> the reason that these ports require sudo?

That's from the old days where everyone liked everyone on the internet and only trusted people ran the computers.  Back then, if a service was running below 1024 it could only be run by root, and since only trusted professionals could become root it meant the service was more likely to be safe.

Of course we now know that's all a bunch of horseshit, but that's the way it is.

The "fix" is to run it with sudo, but tell mongrel to become you afterwards:

sudo mongrel_rails start -p 80 --user mattp --group users

Then, it'll bind to port 80, but still run as you so your file permissions aren't all screwed up later.

Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu
http://www.awprofessional.com/title/0321483502 -- The Mongrel Book
http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help.

More information about the Mongrel-users mailing list