skip to Main Content

When I list files as a root user:

root@complect-shop:~# ls -lah /www/server/php/73/var/log/
total 5.8M
drw-r----- 2 root www  4.0K Oct  8 10:00 .
drwxr-xr-x 4 root root 4.0K Dec 16  2019 ..
-rw-r----- 1 root www  1.5M Jan  7 12:48 php-fpm.log
-rw-r----- 1 root www  4.3M Jan  6 07:12 slow.log
root@complect-shop:~# 

php-fpm.log file has access read an write for root user and read for www group.

Here is the error for user web which is in www group:

╭╴web@complect-shop ~/complect-import-stock-wc
╰╴16:41:03 $ tail /www/server/php/73/var/log/php-fpm.log
tail: cannot open '/www/server/php/73/var/log/php-fpm.log' for reading: Permission denied

Here is a proof user is in the www group:

╭╴web@complect-shop ~/complect-import-stock-wc
╰╴16:45:05 $ groups web
web : web www-data www

2

Answers


  1. The file php-fpm.log will need write access as it is a log file and so allocate wrirte access to the www group

    sudo chmod g+w /www/server/php/73/var/log/php-fpm.log
    
    Login or Signup to reply.
  2. The group www doesn’t have execute permissions on /www/server/php/73/var folder, so, you cannot get in. Grant that permission this way:

    $ sudo chmod g+x /www/server/php/73/var/log/

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search