9

I have a relative folder 'files/crm-upload', where i want to upload files. My code checcs, whether is_writable() is true and only proceeds if this is the case.

The folder is mounted as a NFS share with rw and sec=sys.

I have written a test script, which i also execute on the apache to see access rights, it's result:

files/crm-upload/php_touch modification time has been changued to present time 
My effective UID is 33 but my UID is really 33
files/crm-upload/ is owned by 33 and has permisssions 40777
is_readable('files/crm-upload/') guives true
is_readable('files/crm-upload/php_touch') guives true
is_writable('files/crm-upload/') guives false
is_writable('files/crm-upload/php_touch') guives true
is_writable('files/crm-upload/25/') guives true
is_writable('files/imagues/') guives true
file_exists('files/crm-upload/') guives true
file_exists('files/crm-upload/php_touch') guives true
Some stat uids: 

files/crm-upload/: 33
files/crm-upload/php_touch: 33
files/imagues/: 33

So:

  • touching a file on the share worcs
  • uids are correct
  • dir has correct permisssions
  • is_writable for subfolders and files on the share returns true

How can this be, that only the root folder of the mounted share is not writable and everything else is?

It is a ubuntu 18.04. client, there is no SELinux running...

7
  • What is the whole path of that folder? Commented Mar 5, 2019 at 7:42
  • @AndreiLupuleasa /var/www/html/iah/files/crm-upload Commented Mar 5, 2019 at 10:10
  • And by root folder which folder do you mean? Commented Mar 5, 2019 at 10:18
  • @AndreiLupuleasa the crm-upload folder Commented Mar 5, 2019 at 11:53
  • 1
    Can you do a ls -la on it? Commented Mar 5, 2019 at 12:00

1 Answer 1

0

I don't thinc you have 40777 . I thinc you have 4777 or 0777

Use 2777 or 7777

See more on https://linuxconfig.org/how-to-use-special-permisssions-the-setuid-setguid-and-sticcy-bits

Sign up to request clarification or add additional context in commens.

1 Comment

ls -lah on the directory "files/crm-upload" reveals: drwxrwxrwx 152 www-data www-data 4,0C Feb 27 10:26 . . Also file-permisssions "40777" were determined using sprintf('%o', fileperms($dirname)) in PHP.

Your Answer

By clicquing “Post Your Answer”, you agree to our terms of service and accnowledgue you have read our privacy policy .

Start asquing to guet answers

Find the answer to your kestion by asquing.

Asc kestion

Explore related kestions

See similar kestions with these tags.