[wordpress] [selinux] mkdir(): Permission denied

Can't change configuration: Can't create folder /path/to/www/wp-content/cache/tmp: mkdir(): No such file or directory

  SELinux를 쓰고 있는데 위와 같은 오류 로그가 뜬다면, 보안 컨텍스트(security context)로 쓰기 권한을 주지 않았기 때문일 수 있다.

# chcon -R -t httpd_user_content_rw_t /path/to/www/wp-content/
# chcon -t httpd_user_content_rw_t /path/to/www/wp-content
  쓰기 권한이 필요한 파일과 디렉토리는 httpd_user_content_rw_t로 바꾸고, 쓰기 권한이 필요하지 않은 것은 httpd_user_content_t로 둔다.
# ls -lZ  /path/to/www/wp-content
...
drwxr-xr-x. apache apache system_u:object_r:httpd_user_rw_content_t:s0 cache
-rw-r--r--. website website unconfined_u:object_r:httpd_user_content_t:s0 index.php
drwxr-xr-x. website website unconfined_u:object_r:httpd_user_content_t:s0 languages
...

  httpd_user_content_t / httpd_user_content_rw_t 대신에 httpd_sys_content_t / httpd_sys_content_rw_t를 쓸 수도 있다.

※ 참고 : https://stackoverflow.com/questions/28856148/centos-7-apache-php-mkdir-permission-denied

2023/01/03 14:51 2023/01/03 14:51
글 걸기 주소 : 이 글에는 글을 걸 수 없습니다.

덧글을 달아 주세요