Selinux "Semanage에 컨텍스트 규칙 추가"

Selinux "Semanage에 컨텍스트 규칙 추가"

fcontext semanage에 대한 새 규칙을 임의의 디렉터리에 추가하거나 변경하고 적용하면 다음과 같습니다.

# 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

이렇게 하면 도메인 폴더의 모든 미디어 하위 폴더에 컨텍스트 유형이 적용됩니다.

관련 정보