[plt-scheme] running web-server on port 80 as non-root?

From: Eli Barzilay (eli at barzilay.org)
Date: Sun Feb 5 00:32:33 EST 2006

On Feb  5, Doug Orleans wrote:
> I've been running my PLT web server as root, in order to use port
> 80, on Debian Linux.  It occurs to me that maybe I don't want to be
> doing this...  Apache has the "User" directive that does a setuid
> after binding the listener port.  Can MzScheme do setuid?

| root# mzscheme
| Welcome to MzScheme version 300, Copyright (c) 2004-2005 PLT Scheme Inc.
| > (require (lib "foreign.ss") (lib "process.ss"))
| > (unsafe!)
| > (define setuid (get-ffi-obj "setuid" #f (_fun _int -> _int)))
| > (system "whoami")
| root
| #t
| > (setuid 500)
| 0
| > (system "whoami")
| eli
| #t

> Or should I just write a simple port-forwarder?  Or, is there a way
> to tell Debian to allow a non-root user to use port 80?

Another common setup is to use Apache to proxy connections.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.