selinux – opening additional ports / or disabling

If you are having problems starting apache on a non-standard port you might find that the problem is related to selinux.

Type this command to check to see what http ports are currently allowed;  (remove filter to show all rules)

semanage port -l|grep http

To add another port type the following (with the port you wish to add etc);

semanage port -a -t http_port_t -p tcp 81

If you want to disable selinux completely then go into /etc/selinux/config and set selinux=disabled. Save then reboot.

2 Replies to “selinux – opening additional ports / or disabling”

  1. Hi Gaz,

    what about to allow a tomcat application/user to open port 80 on the system. How can i allow this with the above command?

    I start tomcat application as tomcat user which has nologin as it’s shell.

Leave a Reply

Your email address will not be published.