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 sudo

When a user has been assigned multiple roles, they usually work with their primary role (such as staff_r) and only selectively execute commands with the other role. This can be accomplished through the sudo command, as these commands usually also require a different Linux user (which can be root or the postgresql account for DBA tasks on the PostgreSQL database server).

How to do it…

In order to configure sudo to perform the right role and type transition, execute the following steps:

  1. Open up the sudoers file through visudo:
    ~# visudo
    
  2. Define the commands that the user(s) are allowed to execute. For instance, to allow all users in the dba group to call initdb in the dbadm_r role, define the commands as ...
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