semanage
SELinux persistent policy management tool. Some subcommands such as `boolean`, `fcontext`, `port`, etc. have their own usage documentation.
More info →Subcommands (7)
Manage persistent SELinux boolean settings. See also: `semanage`, `getsebool`, `setsebool`.
Manage persistent SELinux security context rules on files/directories. See also: `semanage`, `matchpathcon`, `secon`, `chcon`, `restorecon`.
Manage SELinux network interface type definitions. See also: `semanage`, `semanage-port`.
Manage SELinux login mappings between Linux users and SELinux users. See also: `semanage`, `semanage-user`.
Manage persistent SELinux permissive domains. Note that this effectively makes the process unconfined. For long-term use, it is recommended to configure SELinux properly. See also: `semanage`, `getenforce`, `setenforce`.
Manage persistent SELinux port definitions. See also: `semanage`.
Manage SELinux user mappings. See also: `semanage`, `semanage-login`.
Options (6)
-m, --modifybooleanSet or unset a SELinux boolean. Booleans allow the administrator to customize how policy rules affect confined process types (a.k.a domains)
sudo semanage boolean {{[-m|--modify]}} {{--on|--off}} {{haproxy_connect_any}}-a, --addbooleanAdd a user-defined file context labeling rule. File contexts define what files confined domains are allowed to access
sudo semanage fcontext {{[-a|--add]}} {{[-t|--type]}} {{samba_share_t}} '/mnt/share(/.*)?'-t, --typebooleanAdd a user-defined file context labeling rule. File contexts define what files confined domains are allowed to access
sudo semanage fcontext {{[-a|--add]}} {{[-t|--type]}} {{samba_share_t}} '/mnt/share(/.*)?'-p, --protobooleanAdd a user-defined port labeling rule. Port labels define what ports confined domains are allowed to listen on
sudo semanage port {{[-a|--add]}} {{[-t|--type]}} {{ssh_port_t}} {{[-p|--proto]}} {{tcp}} {{22000}}-f, --output_filebooleanOutput local customizations in the default store
sudo semanage export {{[-f|--output_file]}} {{path/to/file}}-f, --input_filebooleanImport a file generated by `semanage export` into local customizations (CAREFUL: may remove current customizations!)
sudo semanage import {{[-f|--input_file]}} {{path/to/file}}Examples (6)
Set or unset a SELinux boolean. Booleans allow the administrator to customize how policy rules affect confined process types (a.k.a domains)
sudo semanage boolean [-m|--modify] --on|--off haproxy_connect_anyAdd a user-defined file context labeling rule. File contexts define what files confined domains are allowed to access
sudo semanage fcontext [-a|--add] [-t|--type] samba_share_t '/mnt/share(/.*)?'Add a user-defined port labeling rule. Port labels define what ports confined domains are allowed to listen on
sudo semanage port [-a|--add] [-t|--type] ssh_port_t [-p|--proto] tcp 22000Set or unset permissive mode for a confined domain. Per-domain permissive mode allows more granular control compared to `setenforce`
sudo semanage permissive --add|--delete httpd_tOutput local customizations in the default store