Thursday, March 5, 2015

[VirtualHost: main] (13)Permission denied: make_sock: could not bind to address 0.0.0.0:80

Version:

Oracle HTTP Server 11.1.1.7.0 in Linux 64 Bit

Issue:

opmnctl startall command errors out when invoked with the OS user who installed the product.

Error:

From $INSTANCE_HOME/diagnostics/logs/OHS/ohs1/ohs1.log the following errors are seen

[2015-03-03T11:08:11.5520+00:00] [OHS] [NOTIFICATION:16] [OHS-9999] [core.c] [host_id: webtier1] [host_addr: *.*.*.*] [pid: 2414] [tid: 139750680717120] [user: oracle] [VirtualHost: main]  caught SIGTERM, shutting down

[2015-03-03T16:38:37.7081+05:30] [OHS] [INCIDENT_ERROR:32] [OHS-9999] [core.c] [host_id: webtier1] [host_addr: *.*.*.*] [pid: 5776] [tid: 140408010676032] [user: oracle] [VirtualHost: main] (13)Permission denied:  make_sock: could not bind to address 0.0.0.0:80

[2015-03-03T16:38:37.7081+05:30] [OHS] [INCIDENT_ERROR:20] [OHS-9999] [core.c] [host_id: webtier1] [host_addr: *.*.*.*] [pid: 5776] [tid: 140408010676032] [user: oracle] [VirtualHost: main]  no listening sockets available, shutting down

Reason:

Seeing the logs, we identified the main reason is Permission denied to use the port 80
Permission denied:  make_sock: could not bind to address 0.0.0.0:80

You will get the following error if you try to start Oracle HTTP Server on a port below 1024 as non-root user

Oracle HTTP Server will not start on ports below 1024 because root privileges are needed to bind these ports.

On a UNIX system the TCP/IP port numbers below 1024 are special in that only processes with root privileges are allowed to listen on those ports.

Solution:

By default, Oracle HTTP Server runs as a non-root user (the user that installed Oracle Fusion Middleware). Therefore, on UNIX systems, if you plan on running Oracle HTTP Server on a privileged port (for example, port 80, 443 etc), you must enable Oracle HTTP Server to run as root user

1. Take a backup of  ".apachectl file" (under $WT_HOME/ohs/bin directory) as the software owner (in my case, oracle) to keep current permissions on the file.

Please note that it is a hidden file (.apachectl). There is an unhidden file apachectl also in same dir.

2. Connect as root user and change to the above directory

[root@webtier1 ~]# cd $MW_HOME/Oracle_WT1/ohs/bin

3. Change permissions of the file using below given 2 commands

chown root .apachectl
chmod 6750 .apachectl

[root@webtier1 bin]# chown root .apachectl
[root@webtier1 bin]# chmod 6750 .apachectl

Now the permission of the .apachectl file would be as follows

-rwsr-s---  1 root   dba  13278 Feb  8  2013 .apachectl

4. Exit root and connect back as the S/W owner user (oracle)

5. Edit httpd.conf file

cd $MW_HOME/Oracle_WT1/ohs/conf

Backup httpd.conf before editing

6. Search for the User/Group strings in the file. Then uncomment or add the installation user details.

For eg: originally in my httpd.conf the entries were

#User USER_TEMPLATE
#Group GROUP_TEMPLATE
</IfModule>

The above lines are modified to

User oracle
Group dba
</IfModule>

where oracle is the user with which I installed the Webtier and dba is the primary group of oracle

7. Start the opmnctl service as S/W owner(oracle)




3 comments:

  1. Thanks for the detailed explanation

    ReplyDelete
  2. One suggestion i had with respect the scenario .
    If the group (dba) doesnt has user (oracle) added it throws error like "permission denied for oracle"

    [root@welcome OHS]# grep 'dba' /etc/group
    dba:x:500:
    [root@welcome OHS]#

    If i adds the same , issue is resolved .

    [root@welcome OHS]# grep 'dba' /etc/group
    dba:x:500:oracle
    [root@welcome OHS]#

    Just a suggestion like default user should be added to group , but in my case that was not done and i recievd the error .

    THanks for the beautiful description , Keep going

    ReplyDelete