Troubleshooting

In enforcing mode, SELinux blocks httpd from binding to TCP port 8090. Which command allows the bind without weakening SELinux for the rest of the system?

Show the answer

Correct answerC. semanage port -a -t http_port_t -p tcp 8090

AWhy not this: setenforce 0 switches the whole system to permissive mode, removing SELinux enforcement everywhere.

BWhy not this: This boolean lets httpd make outbound network connections; it does not allow binding a new port.

CWhy this is right: Labelling port 8090 as http_port_t lets httpd bind it while enforcement stays on.

DWhy not this: chcon labels files, and http_port_t is a port type, so this does not change what httpd may bind.

SELinux restricts which ports each domain may bind by port type, and semanage port -a -t labels the new port with the type the daemon is already allowed to use. Disabling SELinux or changing file permissions is unnecessary.