[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Unexpected permission denied



On 25/1/23 15:33, tomas@tuxteam.de wrote:
On Wed, Jan 25, 2023 at 02:51:05PM +0800, jeremy ardley wrote:

[...]

      0.000041 lstat("/var/www/grammartiste.com/web/vendor/autoload.php", 0x7fffdc580970) = -1 EACCES (Permission denied)
      0.000034 lstat("/var/www/grammartiste.com/web/vendor/autoload.php", 0x7fffdc57f900) = -1 EACCES (Permission denied)
Quoting the lstat(2) man page:

        These  functions  return  information  about a file, in the
        buffer pointed to by statbuf.  No permissions are required
        on the file itself, but—in the case of stat(), fstatat(),
        and lstat()—execute (search) permission is required on all
        of the directories in pathname that lead to the file.

So first I'd check the whole path leading to the file for dir
search (aka execute) permissions.

-rwxrwxrwx 1 www-data www-data 771 Jan 24 13:00 /var/www/grammartiste.com/web/vendor/autoload.php
Ugh ;-)

The 777 was simply a hack to try and resolve the problem. Now removed to avoid offence.

Anyway tree permissions:

root@gram01:/# ls -ld var

drwxr-xr-x 12 root root 4096 Nov  7 23:30 var

root@gram01:/# ls -ld var/www

drwxr-xr-x 5 www-data www-data 4096 Jan 23 16:33 var/www

root@gram01:/# ls -ld var/www/grammartiste.com/

drwxr-xr-x 5 www-data www-data 4096 Jan 24 12:51 var/www/grammartiste.com/

root@gram01:/# ls -ld var/www/grammartiste.com/web

drwxr-xr-x 8 www-data www-data 4096 Jan 24 14:54 var/www/grammartiste.com/web

root@gram01:/# ls -ld var/www/grammartiste.com/web/autoload.php

-rwxr-xr-x 1 www-data www-data 312 Jan 24 13:27 var/www/grammartiste.com/web/autoload.php

root@gram01:/# ls -ld var/www/grammartiste.com/web/vendor/autoload.php

-r-xr-xr-x 1 www-data www-data 771 Jan 24 13:00 var/www/grammartiste.com/web/vendor/autoload.php


I have vague memories there are more file flags in newer Linux file systems?

Jeremy


Reply to: