此内容没有您所选择的语言版本。

50.2.12. Useful Commands for Scripts


The following is a list of useful commands introduced with SELinux, and which you may find useful when writing scripts to help administer your system:
getenforce
This command returns the enforcing status of SELinux.
setenforce [ Enforcing | Permissive | 1 | 0 ]
This command controls the enforcing mode of SELinux. The option 1 or Enforcing tells SELinux to enter enforcing mode. The option 0 or Permissive tells SELinux to enter passive mode. Access violations are still logged, but not prevented.
selinuxenabled
This command exits with a status of 0 if SELinux is enabled, and 1 if SELinux is disabled.
~]# selinuxenabled
~]# echo $?
0
getsebool [-a] [boolean_name]
This command shows the status of all booleans (-a) or a specific boolean (<boolean_name>).
setsebool [-P] <boolean_name> value | bool1=val1 bool2=val2 ...
This command sets one or more boolean values. The -P option makes the changes persistent across reboots.
togglesebool boolean ...
This command toggles the setting of one or more booleans. This effects boolean settings in memory only; changes are not persistent across reboots.
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.