• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

getsebool Command in Linux

by admin

SELinux booleans allow you to change the SELinux policy at runtime without the need to write additional policies. This allows you to change the policy without the need for recompilation, such as allowing services to access NFS volumes.

The setsebool command can be used to modify (switch on or off) the value of a SELinux Boolean at runtime as shown in following command line:

# setsebool ftp_home_dir on

The getsebool command can be used with the -a option to display the list of all SELinux Booleans and their current values as shown in the following command line. The output of this command is passed to a grep filter to narrow down the results:

# getsebool -a

The output of the getsebool -a command can be filtered down using grep as shown in the following command line:

# getsebool -a | grep ftp

getsebool Command Examples

1. If you would like a list of all the bare bones of SELinux booleans and their values, getsebool -a is an alternative, as follows:

# getsebool -a

2. Query the status of the httpd_enable_homedirs boolean value:

# getsebool httpd_enable_homedirs

3. It is possible to get the value of a single SELinux boolean without the use of additional utilities, such as grep and/or awk. Simply execute the following:

# getsebool [SELinux boolean]

This shows you whether or not the boolean is set. Here’s an example:

# getsebool virt_use_nfs
virt_use_nfs --> off

Final Thoughts

Managing SELinux booleans can be rather complex as there are a lot of booleans, and their names are not always simple to remember. For this reason, the setsebool, getsebool, and semanage tools come with tab completion. So, whenever you type any boolean name, you can use the tab key to complete or display the possible options.

Filed Under: Linux

Some more articles you might also be interested in …

  1. dpkg-query Command Examples in Linux
  2. lspci: command not found
  3. ncat: command not found
  4. How to use nomodeset to Troubleshoot Boot Issues
  5. efibootmgr Command Examples in Linux
  6. dmidecode: command not found
  7. How to use netstat command under Linux (Examples included)
  8. sysctl setting for high load and prevent DDoS
  9. How to enable Debug Option For CIFS Module in CentOS/RHEL 7 and 8
  10. dig: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • chars: Display names and codes for various ASCII and Unicode characters and code points
  • chafa: Image printing in the terminal
  • cf: Command-line tool to manage apps and services on Cloud Foundry
  • certutil: Manage keys and certificates in both NSS databases and other NSS tokens

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright