How to Fix ‘semanage command’ Not Found Error in CentOS/RHEL

I am trying to configure a Samba share with correct boolean and security context values using semanage command to make changes in SELinux policy to allow access to Samba share from remote clients on my RHEL 8 server, but I suddenly encountered the following error.

# semanage fcontext --at samba_share_t "/finance(/.*)?"

-bash: semanage: command not found
Semanage Command Not Found Error
semanage Command Not Found Error

semanage is an SELinux (Security-Enhanced Linux) management tool that is used to configure specific elements without making any adjustments to or reassembling from policy sources. Semanage consist of mapping from Linux username to SELinux user identities and it also includes mapping security context for numerous kind of objects like interface, network port, etc.

I was wondering how to fix this error and I am not able to find what package provides semanage command. After a bit of research, I came to know that you need to use yum provides the option to find out the package that provides the queried file called /usr/sbin/semanage.

In this short quick article, we will explain how to install necessary packages for getting semanage command using the yum command.

# yum provides /usr/sbin/semanage
Find Packages that Provide the Queried File
Find Packages that Provide the Queried File

From the above sample output, you can see that we need to install policycoreutils-python-utils-2.8-16.1.el8.noarch package to use the semanage command.

# yum install policycoreutils-python-utils
Install Policycoreutils Python Package
Install Policycoreutils Python Package

Once the installation is complete, try running the semanage command again, it will work like magic.

You can also use the following commands to get the manual page on semanage command options and usage.

# man semanage
OR
# semanage --help
Semanage Command Help
Semanage Command Help

Two small things before you go

If something didn’t work on your setup, leave a comment and tell me which distro and version you’re on. I read every one, and most of these articles got better because a reader pointed out what was missing.

And if it did work, share it. TecMint has stayed free for 14 years because people pass these articles around, and that traffic is what pays for writing the next one.

Leave a comment
Get two free Linux courses

Learn the Linux basics with two free courses and join 34,000+ readers getting practical TecMint tutorials and selected Pro TecMint articles every week.

Pro TecMint
Get lifetime access for $99

If you want to go beyond the free tutorials, Pro gives you 18 courses, 5 ebooks, and every future course I add. One payment, lifetime access, no renewals.

Anusha Saive
Anusha Saive
Author
About the author

Anusha is an experienced IT professional who worked as a Project Manager and served as a senior writer and editor at Tecmint. A passionate Linux enthusiast, she is also a fitness and travel lover, HYROX athlete, and certified nutrition specialist.

1 Comment

Leave a Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.