Skip to Content
SELinux Cookbook
book

SELinux Cookbook

by Sven Vermeulen
September 2014
Intermediate to advanced
240 pages
5h 53m
English
Packt Publishing
Content preview from SELinux Cookbook

Running commands in a specified role with runcon

Using sudo is not mandatory. SELinux also provides a command called runcon that allows users to run a command in a different context. Of course, SELinux restrictions still apply—the user must have the proper privileges to execute commands with a different context.

How to do it…

Running a command using a specified role and type is done by completing the following steps:

  1. Identify the domain in which the command should run, usually by checking the executables' context and searching for the entrypoint definition:
    ~$ ls -Z auditctl
    system_u:object_r:auditctl_exec_t    auditctl
    ~$ sesearch -t auditctl_exec_t -c file -p entrypoint -A
    Found 1 semantic av rules:
     allow auditctl_t auditctl_exec_t : file { … entrypoint ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

SELinux

SELinux

Bill McCarty
SELinux by Example: Using Security Enhanced Linux

SELinux by Example: Using Security Enhanced Linux

Frank Mayer, Karl MacMillan, David Caplan
CentOS Quick Start Guide

CentOS Quick Start Guide

Shiwang Kalkhanda

Publisher Resources

ISBN: 9781783989669Supplemental Content