[Mongrel] changing user/group on port 80

Doug Selph dselph at gmail.com
Thu Jun 22 14:04:33 EDT 2006


I'm trying to run mongrel on port 80 and switch to a different
user/group from root. As root, this works:

mongrel_rails start -p 3000 -u rails --group rails

This:

mongrel_rails start -p 80 -u rails --group rails

dies with:

---------------------------
** Changing group to rails.
** Changing user to rails.
** Starting Mongrel listening at 0.0.0.0:80
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.1/lib/mongrel/tcphack.rb:24:in
`initialize_without_backlog': Permission denied - bind(2)
(Errno::EACCES)        from
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.1/lib/mongrel/tcphack.rb:24:in
`initialize'
        from /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.1/lib/mongrel.rb:500:in
`initialize'
        from /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.1/lib/mongrel.rb:822:in
`listener'
        from /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.1/bin/mongrel_rails:91:in
`cloaker_'
        from /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.1/lib/mongrel.rb:752:in
`initialize'
        from /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.1/bin/mongrel_rails:78:in
`run'
        from /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.1/lib/mongrel/command.rb:211:in
`run'
        from /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.1/bin/mongrel_rails:227
        from /usr/local/bin/mongrel_rails:18
---------------------------


It appears that the mongrel process changes privilege before binding
to port 80, which of course is not allowed for non-root process. Is
there a workaround here?


More information about the Mongrel-users mailing list