- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Cloud
- Security

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.*

Lab 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
About the author
Real skill practice before real-world application
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.
Learn by doing
Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.
Follow your guide
All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.
Turn time into mastery
On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.