Book Image

SELinux Cookbook

By : Sven Vermeulen
Book Image

SELinux Cookbook

By: Sven Vermeulen

Overview of this book

Table of Contents (17 chapters)
SELinux Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Mapping Linux users to SELinux users


With the SELinux users available, we can now map Linux users to SELinux users. This will ensure that the users, when logged in to the system, are assigned a default context aligned with this SELinux user.

How to do it…

In order to map Linux users to SELinux users, the following steps can be taken:

  1. List the existing mappings with semanage login:

    ~# semanage login -l
    Login Name           SELinux User              MLS/MCS Range
    
    __default__          user_u                    s0-s0:c0.c1023
    root                 root                      s0-s0:c0.c1023
    system_u             system_u                  s0-s0:c0.c1023
    %wheel               sysadm_u                  s0-s0:c0.c1023
    
  2. For an individual user account, map the account to an SELinux user with semanage login:

    ~# semanage login -a -s dbadm_u user1
    
  3. It is also possible to assign a group of users to an SELinux user through their primary Linux group. For instance, if a dba group exists, it can be assigned to an SELinux...