lighttpd can't bind to port: Permission denied

0

$ sudo service lighttpd start
Starting lighttpd: 
2016-02-29 09:51:24: (network.c.410) can't bind to port:  88 Permission denied
                                                           [FAILED]

in /etc/lighttpd/lighttpd.conf, I have:

var.log_root    = "/var/log/lighttpd"
var.server_root = "/var/www/lighttpd"
var.state_dir   = "/var/run"
var.home_dir    = "/var/www/html/eboardit/static"
var.conf_dir    = "/etc/lighttpd"

#######################################################################
##
##  Basic Configuration
## ---------------------
##
server.port = 88

##
## Use IPv6?
##
server.use-ipv6 = "disable"

I realize there's a very similar question from 4 years ago, but it wasn't answered. lighttpd cant bind port permission denied

I've tried a couple different ports. What should I be looking at? what would permission is required to bind to a port?

Thanks!

Daniel Wilson

Posted 2016-02-29T14:59:04.573

Reputation: 3

Answers

1

It is unusual to get a "Permission denied" message when running a command using sudo. I might check that SELinux isn't installed/enabled.

The usual reason a network service fails to bind to a port is because the TCP port is already in use by some other service. The usual way to check this is

$ sudo netstat -plnt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address       Foreign Address     State       PID/Program name
tcp        0      0 :::80               :::*                LISTEN      3944/httpd
tcp        0      0 :::22               :::*                LISTEN      3834/sshd
tcp        0      0 :::443              :::*                LISTEN      3944/httpd

Here we can see that port 80 is already in use by the httpd program.

If there is a better explanation, someone will be along soon to downvote this answer and post a more useful one :-)

RedGrittyBrick

Posted 2016-02-29T14:59:04.573

Reputation: 70 632

You are right! SELinux was limiting things. Here's another source. https://visibilityspots.org/selinux.html

But SELinux permitted use of 81 ... so switching to 81 worked.

– Daniel Wilson – 2016-02-29T15:57:50.007