HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

secon — Get the SELinux security context of a file, pid, current execution context, or a context specificati

Submitted by: @import:tldr-pages··
0
Viewed 0 times
seconthecommandsecuritycliselinuxgetcontext
linux

Problem

How to use the secon command: Get the SELinux security context of a file, pid, current execution context, or a context specification. See also: semanage, runcon, chcon. More information: <https://manned.org/secon>.

Solution

secon — Get the SELinux security context of a file, pid, current execution context, or a context specification. See also: semanage, runcon, chcon. More information: <https://manned.org/secon>.

Get the security context of the current execution context:
secon


Get the current security context of a process:
secon --pid {{1}}


Get the current security context of a file, resolving all intermediate symlinks:
secon --file {{path/to/file_or_directory}}


Get the current security context of a symlink itself (i.e. do not resolve):
secon --link {{path/to/symlink}}


Parse and explain a context specification:
secon {{system_u:system_r:container_t:s0:c899,c900}}

Code Snippets

Get the security context of the current execution context

secon

Get the current security context of a process

secon --pid {{1}}

Get the current security context of a file, resolving all intermediate symlinks

secon --file {{path/to/file_or_directory}}

Get the current security context of a symlink itself (i.e. do not resolve)

secon --link {{path/to/symlink}}

Parse and explain a context specification

secon {{system_u:system_r:container_t:s0:c899,c900}}

Context

tldr-pages: linux/secon

Revisions (0)

No revisions yet.