semanage(8) - Linux man page
Name
semanage - SELinux Policy Management toolSynopsis
semanage {login|user|port|interface|fcontext|translation} -l [-n]semanage login -{a|d|m} [-sr] login_name
semanage user -{a|d|m} [-LrRP] selinux_name
semanage port -{a|d|m} [-tr] [-p protocol] port | port_range
semanage interface -{a|d|m} [-tr] interface_spec
semanage fcontext -{a|d|m} [-frst] file_spec
semanage translation -{a|d|m} [-T] level
Description
Options
- -a, --add
- Add a OBJECT record NAME
- -d, --delete
- Delete a OBJECT record NAME
- -f, --ftype
- File Type. This is used with fcontext. Requires a file type as shown in the mode field by ls, e.g. use -d to match only directories or -- to match only regular files.
- -h, --help
- display this message
- -l, --list
- List the OBJECTS
- -L, --level
- Default SELinux Level for SELinux use, s0 Default. (MLS/MCS Systems only)
- -m, --modify
- Modify a OBJECT record NAME
- -n, --noheading
- Do not print heading when listing OBJECTS.
- -p, --proto
- Protocol for the specified port (tcp|udp).
- -r, --range
- MLS/MCS Security Range (MLS/MCS Systems only)
- -R, --role
- SELinux Roles. You must enclose multiple roles within quotes, separate by spaces. Or specify -R multiple times.
- -P, --prefix
- SELinux Prefix. Prefix added to home_dir_t and home_t for labeling users home directories.
- -s, --seuser
- SELinux user name
- -t, --type
- SELinux Type for the object
- -T, --trans
-
SELinux Translation
Example
# View SELinux user mappings $ semanage user -l # Allow joe to login as staff_u $ semanage login -a -s staff_u joe # Add file-context for everything under /web (used by restorecon) $ semanage fcontext -a -t httpd_sys_content_t "/web(/.*)?" # Allow Apache to listen on port 81 $ semanage port -a -t http_port_t -p tcp 81
