selinux的初級管理


1 什麼時selinux

selinux,內核級加強型防火牆

 

2 如何管理selinux級別

selinux開啓或者關閉)

vim /etc/sysconfig/selinux

    selinux=disabled##關閉狀態

    selinux=Enforcing##強制狀態

    selinux=Permissive##警告狀態

 

getenforce##查看狀態

selinux開啓時

setenforce 0|1##更改selinux運行級別

 

3.如何更改文件安全上下文

臨時更改)

chcon -t 安全上下文文件

chcon -t public_content_t /publicftp -R

 

永久更改)

semanage fcontext -l##列出內核安全上下文列表內容

semanage fcontext -a -t public_content_t '/publicftp(/.*)?'

restorecon -FvvR /publicftp/

 

4.如何控制selinux對服務功能的開關

getsebool -a | grep 服務名稱

getsebool -a | grep ftp

setsebool -P 功能boolon|off

setsebool -Pftpd_anon_write on

 

5.監控selinux的錯誤信息

setroubleshoot-server

 

6.安全上下文

semanage fcontext -a -t public_content_t '/westos(/.*)?'

restorecon -FvvR /westos/

ls -Zdl /westos/

 

 


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章