
Recibo algunos errores de permisos extravagantes con Apache. Puedo acceder a documentos en el directorio de inicio de Apache pero no en ningún otro directorio.
Cuando veo mi error_log de Apache, se muestra
[error] (13)Permission denied: access to / denied
Tengo el permiso de archivos y carpetas establecido en 777 y sé que mi httpd.conf está configurado correctamente.
Aquí está lo extraño
cuando ejecuto esto para un archivo en el directorio de Apache, funciona bien
su -s /bin/bash -c "cat /usr/local/apache2/htdocs/index.html" apache
<html><body><h1>It works!</h1></body></html>
Cuando ejecuto esto para un archivo externo con los mismos permisos obtengo
su -s /bin/bash -c "cat /var/www/html/index.html" apache
cat: /var/www/html/index.html: Permission denied
Pensé que esto debía ser algo de Selinux, así que lo desactivé configurando SELINUX=disabled en /etc/selinux/config y reiniciando el servidor, pero no funcionó.
Estoy usando una instalación nueva de CentOS 4.8 y mis directorios web están sincronizados desde mi servidor web principal.
Actualizar
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
Respuesta1
Por lo que has publicado, diría que necesitas otorgar permisos a Apache para acceder a /var.
Respuesta2
[error] (13)Permiso denegado: acceso a / denegado
Es posible que un CGI o un complemento esté intentando crear un archivo en formato /. Vea si puede rastrear exactamente qué operación está creando el error.