Tuesday, August 14, 2012

Permission denied: make_sock: could not bind to address


Permission denied: make_sock: could not bind to address


The other day when I was trying to bind httpd service (apache) on port 81,  I got an error saying "Permission denied: make_sock: could not bind to address" .

httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
(13)Permission denied: make_sock: could not bind to address [::]:81
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:81
no listening sockets available, shutting down
Unable to open logs

After a bit of debugging, found that the problem was with the policy that allows only favoured http ports.  

Use the semanage utility to find the ports.

1. semanage port -l | grep http 
http_port_t                    tcp      80, 443, 488, 8008, 8009, 8443

As you see , port 81 is not listed among the typical http ports

2. Add port 81 ( or any port of ur choice) to this list

semanage port -a -t http_port_t -p tcp 81.

3. Verify the port added
   
semanage port -l | grep http 
http_port_t                    tcp      81, 80, 443, 488, 8008, 8009, 8443

4. Restart httpd service. The service should start now!!

If you wish to remove a port from the favoured list , do as follows:

1. To remove port 81 ( added above) from the favoured http port list

semanage port -d -t http_port_t -p tcp 81

2. Verify whether the port is removed..

semanage port -l | grep http 
http_port_t                    tcp      80, 443, 488, 8008, 8009, 8443

Thats it!




1 comment:

  1. Hi, I do think this is a great web site. I stumbledupon it ;) I'm going to come back once again since I book-marked it. Money and freedom is the best way to change, may you be rich and continue to guide others.

    Here is my website :: watch dogs game

    ReplyDelete