LOGBOOK

HELP

Quiz Entry - updated: 2026.06.20

What is the complete SELinux command reference summary?

Four command families cover SELinux administration: getenforce/setenforce for the MODE, semanage fcontext + restorecon/chcon for FILE contexts, getsebool/setsebool -P for BOOLEANS, and semanage port for PORTS — with ausearch + sealert for troubleshooting denials.

Grouping the tools by what they label is the fastest way to recall them: mode is the global switch, then everything else is about adjusting one of the three kinds of label (file, boolean-guarded behaviour, port) or reading the audit trail when a label is wrong. Note the recurring -P on setsebool (persist across reboot) and the semanage pattern -a/-d/-m/-l (add/delete/modify/list) shared by fcontext and port.

Mode management:

# Show current mode
getenforce
# Set Permissive/Enforcing
setenforce 0|1

File context management:

# List context rules
semanage fcontext -l
# Add rule
semanage fcontext -a -t TYPE 'PATH(/.*)?'
# Apply policy context
restorecon -Rv /path
# Temporary change
chcon -t TYPE file

Boolean management:

# List all booleans
getsebool -a
# Check specific
getsebool BOOLEAN
# Set temporary
setsebool BOOLEAN on|off
# Set permanent
setsebool -P BOOLEAN on|off

Port management:

# List port labels
semanage port -l
# Add
semanage port -a -t TYPE -p PROTO PORT
# Delete
semanage port -d -t TYPE -p PROTO PORT
# Modify
semanage port -m -t TYPE -p PROTO PORT
# Show local changes
semanage port -l -C

Troubleshooting:

# Find denials
ausearch -m AVC -ts recent
# Analyze
sealert -a /var/log/audit/audit.log

From Quiz: LIOS / SELinux Security | Updated: Jun 20, 2026