⚠️ IMPORTANT DISCLAIMER: The tools and scripts on this site are provided "AS IS" for educational purposes.
Review destructive commands before executing. By using this site, you assume all risk and agree to our Full Terms of Service.
When SELinux or AppArmor blocks something, the log line is hard to read and the tempting fix is to switch protection off. Paste the denial and you get what was blocked, which process tried it, and the narrowest fix: a file label, a boolean or a port label, instead of setenforce 0.
In avc: denied { read } for pid=1234 comm="nginx" name="index.html" scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file, the process nginx running as type httpd_t was refused read on a file labelled user_home_t. The fix is almost always to give the file the right label, not to change the policy.
Label the folder for web content and apply the label: sudo semanage fcontext -a -t httpd_sys_content_t "/srv/www(/.*)?" then sudo restorecon -Rv /srv/www. Use httpd_sys_rw_content_t for folders the app must write to. Files moved with mv keep their old label, which is a common cause.
SELinux stops web servers making network connections by default. sudo setsebool -P httpd_can_network_connect 1 allows it (or httpd_can_network_connect_db for databases only). getsebool -a | grep httpd lists the related switches.
Add the port to the right type: sudo semanage port -a -t http_port_t -p tcp 8081 for a web server, or ssh_port_t for SSH on another port. semanage port -l | grep http shows which ports are already allowed.
Only after the label and boolean fixes don’t apply. audit2allow writes a policy module that allows exactly what was denied, which can open far more than intended. Read its output before loading it. For AppArmor, sudo aa-logprof plays a similar role, and aa-complain logs without blocking while you test.
Related tools: Permission Simulator · Error Message Decoder · All tools A–Z
Most tools run entirely in your browser. Tools marked 📡 contact outside services, as listed in the Privacy Policy. Review commands before you run them; see the Terms.