• 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. How to monitor /etc/shadow and /etc/passwd file for changes with Auditd?
  2. modprobe Command Options
  3. Linux OS Service ‘rpcgssd’
  4. How to Reset Root Password in CentOS/RHEL 8
  5. CentOS / RHEL : How to Set up SFTP to Chroot Jail only for Specific Group
  6. Linux OS Service ‘nfslock’
  7. Apache HTTP server – most commonly used configuration directives
  8. Linux OS service ‘nfs’
  9. pvcreate Command Examples in Linux
  10. How to Add a 3rd Disk to Create a 3-way Mirror RAID1 MD Device (CentOS/RHEL 7)

You May Also Like

Primary Sidebar

Recent Posts

  • JavaFX ComboBox: Set a value to the combo box
  • Nginx load balancing
  • nginx 504 gateway time-out
  • Images preview with ngx_http_image_filter_module

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright