Selinux 並沒有這麼可怕,不必每次看到 Selinux ,就把他 Disable。
以下是和 SElinux 有關的指令:
- sestatus 顯示 SELinux 的狀態
# sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: enforcing
Mode from config file: enforcing
Policy version: 21
Policy from config file: targeted
參數
-v
-b 顯示 selinux 的policy boolean 值
- setenforce 強制啟動或停止 SElinux
- setsebool 設定 SElinux 的全域 boolean 值
- getsebool 取得 SElinux 的全域 boolean 值
- chcon 改變檔案之 selinux 權限屬性
- fixfiles 修正檔案之 selinux context 內文
- ls 列出檔案 selinux 權限
參數
--lcontext
Display security context. Enable -l. Lines will probably be too wide for most dis-
plays.
-Z, --context
Display security context so it fits on most displays. Displays only mode, user,
group, security context and file name.
--scontext
Display only security context and file name.
--help display this help and exit
--version
output version information and exit
這是和 SElinux 有關的檔案,以 Redhat 為例
- /etc/selinux/config selinux 的設定
- /etc/sestatus.conf selinux 的全域boolean 值