Selinux「將上下文規則加入 Semanage」

Selinux「將上下文規則加入 Semanage」

當您新增或變更新規則以將 fcontext 管理到任何目錄並套用時,egg:

# How to add this rule for apply changes whit restoreconf -Rv
/var/www/html(/.*)?/media(/.*)?   system_u:object_r:httpd_sys_rw_content_t:s0
# Here found all files have .bin and conf 
/etc/selinux/targeted/contexts/files

是否要申請的結果是使用一般的httpd資料夾來讀寫SELinux都沒有問題。

semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/domain.com/media
#restorecon -Rv not apply changes

答案1

您的問題似乎有點不完整,但從我收集的資訊來看,您希望將上下文應用於虛擬主機/網域的httpd_sys_rw_content_t所有子資料夾及其中的所有內容。media這些命令應該可以為您做到這一點:

semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/(.*)/media(/.*)?"
restorecon -Rv /var/www/html

這應該將上下文類型應用於網域資料夾中的所有媒體子資料夾。

相關內容