- Lab
- A Cloud Guru
Granting `sudo` Privileges to Confined Users
In this lab, we'll review the process of granting `sudo` privileges to SELinux confined users. When working with SELinux confined users, you may run into problems with Linux users not being able to use `sudo` anymore. We'll discuss why this happens and how to resolve the issue. *This course is not approved or sponsored by Red Hat.*
Path Info
Table of Contents
-
Challenge
Map `pbeesly` and `jhalpert` to the Appropriate SELinux User
- Become root.
sudo su
- Run the following commands to map
pbeesly
andjhalpert
to thestaff_u
SELinux user:
semanage login -a -s "staff_u" pbeesly semanage login -a -s "staff_u" jhalpert
-
Challenge
Add `pbeesly` and `jhalpert` to the `sudoers` File
- Open the
sudoers
file.
visudo
- Type
/
and search for the lineroot ALL=(ALL) ALL
. - Add the following two lines under the line
root ALL=(ALL) ALL
:
pbeesly ALL=(ALL) TYPE=administrator_t ROLE=administrator_r /bin/sh jhalpert ALL=(ALL) TYPE=administrator_t ROLE=administrator_r /bin/sh
- Open the
-
Challenge
Update the SELinux Security Context of Each User's Home Directory
- Run the following commands to update the SELinux security context of each user's home directory:
restorecon -FR -v /home/pbeesly restorecon -FR -v /home/jhalpert
What's a lab?
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.