User Tools

Site Tools


linux:selinux_cheatsheet

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
linux:selinux_cheatsheet [2023/02/27 14:19] – created dodgerlinux:selinux_cheatsheet [2023/02/27 14:25] (current) dodger
Line 1: Line 1:
 ====== [CHEATSHEET] selinux ====== ====== [CHEATSHEET] selinux ======
  
 +====== Binaries ======
 +===== Add path as binaries to allow execution =====
 +<code bash>
 +semanage fcontext -a -t bin_t '/app/bin/.*'
 +</code>
 +
 +===== Change security context of files/folder =====
 +<code bash>
 +chcon -Rv -u system_u -t bin_t '/app/data/executable.sh'
 +</code>
 +
 +===== List defined paths by context =====
 +
 +<code bash>
 + semanage fcontext --list
 +</code>
 +
 +
 +===== Restore Default Security Contexts =====
 +Over 1 file:
 +<code bash>
 +restorecon -v /var/www/html/index.html
 +</code>
 +
 +or to recursively restore the default security contexts for the whole directory:
 +<code bash>
 +restorecon -Rv /var/www/html 
 +</code>
  
 ====== Networking ====== ====== Networking ======
Line 16: Line 44:
 </code> </code>
  
 +===== Empty =====
  
 +<code bash>
 +
 +</code>
linux/selinux_cheatsheet.1677507574.txt.gz · Last modified: 2023/02/27 14:19 by dodger