[Twisted-Python] Twisted perspective broker on port 80, problem

Is there any reason why I am getting this error when I try to get perspective broker to be on port 80? twisted.internet.error.CannotListenError: Couldn't listen on any:80: (13, 'Permission denied'). I made sure port 80 was not used by Apache or anything else by checking with netstat. Here is the relevant pieces of twisted code: application = twisted.application.service.Application("eventserver") rpcservice = TheService() flashservice = XMLSocket(FlashReceiver) myServiceCollection = twisted.application.service.IServiceCollection(application) portalmonitor = portal.Portal(DefaultRealm()) dbu=twisted.cred.checkers.InMemoryUsernamePasswordDatabaseDontUse() dbu.addUser("user1","pass1") portalmonitor.registerChecker(dbu) internet.TCPServer(5002, server.Site(rpcservice.getResource())).setServiceParent(myServiceCollection) internet.SSLServer(80, pb.PBServerFactory(portalmonitor),ssl.DefaultOpenSSLContextFactory('privkey.pem','cacert.pem')).setServiceParent(myServiceCollection) internet.TCPServer(5001, flashservice).setServiceParent(myServiceCollection)

On Wed, Jun 17, 2009 at 1:32 PM, hbd<happybrowndog@hotmail.com> wrote:
Are you running this at root? Aka "sudo twistd ...". Specifically: Programs written to listen on a port number lower than 1024 must be executed with root privilege (that is, UID 0) -Alex
-- Alex Clemesha clemesha.org

If you want to run PB on port 80, you need to start twistd with root privileges. Do you really want to serve PB on port 80? You probably want to serve it on an un-privileged port (> 1023). I think the spread source suggests 8787 as the port to use for a PBServer. -Dorian On Wed, Jun 17, 2009 at 1:32 PM, hbd <happybrowndog@hotmail.com> wrote:

\On Wed, Jun 17, 2009 at 4:32 PM, hbd<happybrowndog@hotmail.com> wrote:
On Linux (and probably some other unixes), only root can bind to ports <= 1024. A common solution is to use the 'authbind' program, or to just run your program as root and then drop privileges after you bind to the port. twistd supports that with the --uid and --gid parameters. -- Christopher Armstrong http://radix.twistedmatrix.com/ http://planet-if.com/ http://canonical.com/

On Wed, Jun 17, 2009 at 1:32 PM, hbd<happybrowndog@hotmail.com> wrote:
Are you running this at root? Aka "sudo twistd ...". Specifically: Programs written to listen on a port number lower than 1024 must be executed with root privilege (that is, UID 0) -Alex
-- Alex Clemesha clemesha.org

If you want to run PB on port 80, you need to start twistd with root privileges. Do you really want to serve PB on port 80? You probably want to serve it on an un-privileged port (> 1023). I think the spread source suggests 8787 as the port to use for a PBServer. -Dorian On Wed, Jun 17, 2009 at 1:32 PM, hbd <happybrowndog@hotmail.com> wrote:

\On Wed, Jun 17, 2009 at 4:32 PM, hbd<happybrowndog@hotmail.com> wrote:
On Linux (and probably some other unixes), only root can bind to ports <= 1024. A common solution is to use the 'authbind' program, or to just run your program as root and then drop privileges after you bind to the port. twistd supports that with the --uid and --gid parameters. -- Christopher Armstrong http://radix.twistedmatrix.com/ http://planet-if.com/ http://canonical.com/
participants (6)
-
Alex Clemesha
-
Christopher Armstrong
-
Dorian Raymer
-
hbd
-
Phil Christensen
-
Volodymyr Orlenko