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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • 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. How to Tune Btrfs Filesystem for Better Performance
  2. Linux OS Service ‘portreserve’
  3. swupd Command Examples in Linux
  4. update-alternatives: command not found
  5. exec: command not found
  6. catimg: Image printing in the terminal
  7. fallocate Command Examples in Linux
  8. Troubleshooting “connection refused” From Remote Servers in CentOS/RHEL 7 (Either Firewalld or iptables service issue)
  9. sinfo Command Examples in Linux
  10. tomb Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • gml2gv Command Examples
  • glow Command Examples
  • glib-compile-resources Command Examples
  • glances Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright