0
root@SERVER:~# cat /etc/passwd | grep www-data
www-data:x:33:33:www-data:/var/www:/bin/sh

root@SERVER:~# ls -al /cluster/www/html/tmp/reportexport_274.xml
-rwxrwxrwx 1 www-data www-data 908 2011-03-30 14:03 /cluster/www/html/tmp/reportexport_274.xml

root@SERVER:~# sudo -u www-data cat /cluster/www/html/tmp/reportexport_274.xml
cat: /cluster/www/html/tmp/reportexport_274.xml: Permission denied

The directory is an nfs mount:

x:/cluster/www /cluster/www nfs _netdev,rw,soft,intr,rsize=32768,wsize=32768,nosuid,nodev,noatime,timeo=15 0 0

Linux x 2.6.32-31-server #61-Ubuntu SMP Fri Apr 8 19:44:42 UTC 2011 x86_64 GNU/Linux

How can this be? am I missing something?

Caleb
  • 11,813
  • 4
  • 36
  • 49

2 Answers2

2

How about sudo -u www-data ls -l /cluster/www/html/tmp/? Perhaps www-data is missing permissions to reach the directory entry. If that's the case chown/chmod each directory up to tmp so they are readable/executable by www-data.

Eduardo Ivanec
  • 14,881
  • 1
  • 37
  • 43
  • sudo -u www-data ls -l /cluster/www/html/tmp/*.xml ls: cannot access /cluster/www/html/tmp/export_274.xml: Permission denied – Fivetide May 10 '11 at 12:52
  • @user80973: do `sudo -u www-data ls -ld /cluster/www/html/tmp`, `sudo -u www-data ls -ld /cluster/www/html`, etc. until it doesn't result in an error or you get to /cluster. You have to change the permissions in the directories giving permission errors by using `chmod a+rx /path/to/dir`. At the very least you'll probably have to execute `chmod a+rx /cluster/www/html/tmp`. – Eduardo Ivanec May 10 '11 at 12:55
  • 1
    yeh it was missing the lack of +x . :) – Fivetide May 10 '11 at 12:58
0

Check that the directories in the path all in some manner allow user www-data read and execute permission.

user9517
  • 115,471
  • 20
  • 215
  • 297