[Mongrel] OSX requires sudo for using ports < 1024

Jan Svitok jan.svitok at gmail.com
Thu Nov 16 16:46:28 EST 2006


On 11/16/06, 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_rails start -p 80
> ** Starting Mongrel listening at 0.0.0.0:80
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.14/lib/mongrel/tcphack.rb:12:in
> `initialize_without_backlog': Permission denied - bind(2) (Errno::EACCES)
>         from /usr/local/lib/ruby/gems/1.8/gems/mongrel-
> 0.3.14/lib/mongrel/tcphack.rb:12:in `initialize'
>         from
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.14/lib/mongrel.rb:536:in
> `initialize'
>         from
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.14/lib/mongrel/configurator.rb:128:in
> `listener'
>         from
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.14/bin/mongrel_rails:96:in
> `cloaker_'
>         from
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.14/lib/mongrel/configurator.rb:51:in
> `initialize'
>         from /usr/local/lib/ruby/gems/1.8/gems/mongrel-
> 0.3.14/bin/mongrel_rails:83:in `run'
>         from
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.14/lib/mongrel/command.rb:211:in
> `run'
>         from
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.14/bin/mongrel_rails:235
>         from /usr/local/bin/mongrel_rails:18
>
> Mongrel runs without sudo on all other ports > 1024 otherwise. Anyone have
> the reason that these ports require sudo?

This is standard unix behaviour - only root can bind ports < 1024 -
they are called "privileged". The reason is because these ports are
reserved for servers -HTTP, FTP, etc. and therefore it is desirable
that only trusted users (=root) can run them.


More information about the Mongrel-users mailing list