기발한 Linux 권한 오류

기발한 Linux 권한 오류

Apache에서 몇 가지 이상한 권한 오류가 발생합니다. Apache 홈 디렉터리 아래의 문서에 액세스할 수 있지만 다른 디렉터리 아래에서는 액세스할 수 없습니다.

Apache error_log를 보면 다음과 같이 표시됩니다.

[error] (13)Permission denied: access to / denied

파일 및 폴더 권한이 777로 설정되어 있고 httpd.conf가 올바르게 설정되어 있음을 알고 있습니다.

여기서 이상한 점이 있다

아파치 디렉토리에 있는 파일에 대해 이것을 실행하면 정상적으로 작동합니다.

su -s /bin/bash -c "cat /usr/local/apache2/htdocs/index.html" apache
<html><body><h1>It works!</h1></body></html>

내가 얻은 것과 동일한 권한을 가진 외부 파일에 대해 이것을 실행할 때

su -s /bin/bash -c "cat /var/www/html/index.html" apache
cat: /var/www/html/index.html: Permission denied

나는 이것이 selinux 일 것이라고 생각하여 /etc/selinux/config에서 SELINUX=disabled를 설정하고 서버를 다시 시작하여 기능을 껐지만 작동하지 않았습니다.

저는 CentOS 4.8을 새로 설치하여 사용하고 있으며 웹 디렉토리는 기본 웹 서버에서 rsync됩니다.

업데이트

 ls -lZ
Sorry, this option can only be used on a SELinux kernel.

 id apache
uid=48(apache) gid=48(apache) groups=48(apache)

ls -l /var /var/www /var/www/html /var/www/html/index.html

-rwxrwxrwx   1 apache apache    7 Jan 18 15:36 /var/www/html/index.html

/var:
total 192
drwxr-xr-x   2 root    root    4096 Dec 28 09:04 account
drwxr-xr-x   9 root    root    4096 Dec 28 09:04 cache
drwxr-xr-x   3 netdump netdump 4096 Dec 28 09:04 crash
drwxr-xr-x   3 root    root    4096 Dec 28 09:04 db
drwxr-xr-x   2 root    root    4096 Dec 29 13:31 doc
drwxr-xr-x   3 root    root    4096 Dec 28 09:04 empty
drwxr-xr-x   3 root    root    4096 Dec 28 09:06 ftp
drwxr-xr-x   7 root    root    4096 Jan 15 10:24 httpdocs
drwxr-xr-x   7 root    root    4096 Dec 29 13:31 installed_packages
drwxr-xr-x  24 root    root    4096 Jan  4 09:54 lib
drwxr-xr-x   2 root    root    4096 Feb 21  2005 local
drwxrwxr-x   6 root    lock    4096 Jan 19 04:02 lock
drwxr-xr-x  12 root    root    4096 Jan 19 07:50 log
lrwxrwxrwx   1 root    root      10 Dec 28 09:03 mail -> spool/mail
drwxr-x---   5 root    named   4096 Jul 29 14:10 named
drwxr-xr-x   2 root    root    4096 Feb 21  2005 nis
drwxr-xr-x   2 root    root    4096 Feb 21  2005 opt
drwxr-xr-x   2 root    root    4096 Feb 21  2005 preserve
drwxr-xr-x  22 root    root    4096 Jan 19 07:44 run
drwxr-xr-x  14 root    root    4096 Dec 28 09:04 spool
drwxrwxrwt   2 root    root    4096 Jan 15 04:30 tmp
drwx------   2 root    root    4096 Feb 21  2005 tux
drwxr-xr-x   8 root    root    4096 Nov 12 05:56 www
drwxr-xr-x   2 root    root    4096 Jan 19 10:26 www2
drwxr-xr-x   3 root    root    4096 Dec 28 09:04 yp

/var/www:
total 48
drwxr-xr-x   2 root      root 4096 Nov 12 05:56 cgi-bin
drwxr-xr-x   3 root      root 4096 Dec 28 09:16 error
drwxr-xr-x   2 root      root 4096 Jan 18 15:36 html
drwxr-xr-x   3 root      root 4096 Dec 28 09:16 icons
drwxr-xr-x  13 root      root 4096 Dec 28 09:16 manual
drwxr-xr-x   2 webalizer root 4096 Jan 19 04:02 usage

/var/www/html:
total 8
-rwxrwxrwx  1 apache apache 7 Jan 18 15:36 index.html

답변1

당신이 게시한 내용에 따르면 /var에 액세스하려면 아파치 권한을 부여해야 한다고 말하고 싶습니다.

답변2

[오류] (13)권한 거부됨: 접근/거부됨

CGI 또는 플러그인이 /에 파일을 생성하려고 시도 중일 수 있습니다. 정확히 어떤 작업으로 인해 오류가 발생하는지 추적할 수 있는지 확인하세요.

관련 정보