Sure! Here are a few basic examples related to SELinux:
1. Check Current SELinux Status
To check if SELinux is enabled and its current mode:
sestatus
2. Change SELinux Mode Temporarily
To set SELinux to permissive mode (for testing):
setenforce 0
To revert back to enforcing mode:
setenforce 1
3. List SELinux Contexts
To list the SELinux context of a file:
ls -Z /path/to/file
4. Change File Context
To change the context of a file to httpd_sys_content_t:
chcon -t httpd_sys_content_t /var/www/html/index.html
5. View SELinux Audit Logs
To view SELinux denials and audit logs:
ausearch -m avc -ts recent
6. Restore Default Contexts
To restore the default SELinux context for files in a directory:
restorecon -Rv /var/www/html
These commands can help you manage and troubleshoot SELinux settings. If you need more specific examples or explanations, let me know!
