• 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

setsebool 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

setsebool Command Examples

1. To set a boolean value to a particular one, use the following command:

# setsebool [SELinux boolean] [on|off]

Here’s an example command:

# setsebool virt_use_nfs on

This command allows you to change the value of the boolean, but it is not persistent across reboots. To allow persistence, add the -P option to the command line, as follows:

# setsebool -P virt_use_nfs on

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

3. Modify runtime value as well as the default values of the SELinux Boolean simultaneously by using the setsebool command with the -P option as shown in the following command line:

# setsebool -P ftp_home_dir on

Filed Under: Linux

Some more articles you might also be interested in …

  1. UNIX / Linux : How crontab validates the access based on the cron.allow and cron.deny files
  2. How to Use Udev Rules to Create oracleasm Disks in CentOS/RHEL 8
  3. dphys-swapfile Command Examples in Linux
  4. How to uninstall scons package from Ubuntu
  5. apt Command Examples in Linux
  6. gzip: command not found
  7. How to Mask or Unmask a Service in CentOS/RHEL 7 and 8
  8. How to configure xhost to be persistent across reboots in Linux
  9. How to check failed or bad login attempts in Linux
  10. CentOS / RHEL : How to add new swap partition

You May Also Like

Primary Sidebar

Recent Posts

  • fprintd-delete Command Examples in Linux
  • fprintd-delete: command not found
  • foreman: command not found
  • foreman Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright