macournoyer/thin — Issue #75: Starting w/ sudo on ports >1024 fails to bind w/ -u option.
Author: ryan-allen
Created: 2011-11-29 07:04:48+00:00
State: open

Hallo!

Starting thin like this:

`sudo thin start -p 80 -u nobody -g nobody`

Fails to bind to port 80. I've had a bit of a poke in the source and I see no non-obvious and easy way of fixing this.

What happens is that the Controller calls the Daemonize mixin's method to change the UID and GID (using Process) before it calls the method on the TcpServer instance that starts EventMachine, which tries to bind to port 80.

EventMachine has a method for setting the UID, I don't know the implications of calling start_server followed by the method to change the UID. Otherwise I'd hack away and suggest a fix but I don't know how to do it safely (yet).

I'll try and figure it out but if someone smarter knows what to do, then, well that'd be swell!