在 Ubuntu 上查看 SELinux 状态,可以按下面几种方式操作:
sestatus 命令(最直接)sestatus
SELinux status: enabled
Current mode: enforcing
说明 SELinux 已启用。Command 'sestatus' not found
说明 可能未安装 SELinux。getenforce 命令getenforce
可能返回值:
Enforcing:强制模式Permissive:宽容模式Disabled:已禁用如果命令不存在,也说明 SELinux 未安装或未启用。
cat /proc/cmdline | grep selinux
或:
cat /etc/selinux/config
查看:
SELINUX=enforcing
或
SELINUX=disabled
Ubuntu 默认并不使用 SELinux,而是使用 AppArmor。
你可以确认:
aa-status
apparmor module is loaded,说明系统在用 AppArmor。sestatus / getenforce如果你是打算 开启 SELinux 或 排查安全问题,可以告诉我你的 Ubuntu 版本,我可以给你具体步骤。