I try to run a webserver on my machine, but when I start it, it tell
me that it cannot bind to port 80.
> can't bind to port: 80 Permission denied
The problem is that my user probably does not have privileges to use
port 80.
No other application uses that port.
I use debian.
How can a grant user X permissions to bind/use/listen to certain
ports ?
Thanks you !
How do you try to run your webserver? The standard debian way of running
apache is through an init script which allows it to bind to port 80
because it is started by root.
Robert
> lighttpd -f config.conf
On Apr 1, 7:08 pm, Robert Harris <robert.f.har...@blueyonder.co.uk>
wrote:
For an user-mode server you have to pick
a port above 1024: The ports from 1 to 1023
are privileged ports available to root code
only.
--
Tauno Voipio
tauno voipio (at) iki fi
> The problem is that my user probably does not have privileges to use
> port 80.
> No other application uses that port.
> I use debian.
>
> How can a grant user X permissions to bind/use/listen to certain
> ports ?
You probably don't want to do this. But if you insist, here's how you
do it:
1) You run a daemon application, as root, that he connects to.
2) He sends the daemon the port he wants and the IP he wants it bound
to (if any).
3) The root application verifies that his request is allowed,
allocates a socket, and binds it.
4) If there is no error, the root application hands the bound socket
to his application.
Alternatively, it can be done this way:
1) You write a secure daemon application that is setuid-root. He
launches the daemon application.
2) The daemon allocates the port he wants to use.
3) The daemon drops all root privileges and assumes the user's
privileges.
4) The daemon exec's the user's application.
5) The user's application inherits the socket from the daemon.
Again, though, this is not recommend.
DS
> 1) You run a daemon application, as root, that he connects to.
what application should I run as daemon (as root), that will run
lighty ?
Oh, I just figured out, i need to use inetd - main network daemon,
that has root access to well known ports. I can configure this daemon
so that it will know applications interested to receive messanges from
port 80 (lighty in my case). Inetd will receive messages as root, and
will "send them" to lighty which will run as another user.
> Oh, I just figured out, i need to use inetd - main network daemon,
> that has root access to well known ports. I can configure this daemon
> so that it will know applications interested to receive messanges from
> port 80 (lighty in my case). Inetd will receive messages as root, and
> will "send them" to lighty which will run as another user.
That's certainly one way to do it. In your case, that may be the best
way.
DS
> Have you checked whether there is a Debian package for
> lighttpd?
Yes, there is. It's called lighttpd, just installed it yesterday
to implement a local Debian/Ubuntu mirror for my university's
physics faculty network.
Wolfgang