homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

php wont delete 775 dir chmod

 2:37 am on Sep 6, 2010 (gmt 0)

OK help me understand this.

I have 2 users in my linux system that are BOTH part of "web-users" group.

one is www-data used by the webserver and php-cgi
one is my ftp-user

when I upload files via ftp they are set to 775 for dirs and 664 for files, when I run a script on the server (so same group like the ftp user) to delete that directory and files inside: unlink for files works ok but the command rmdir doesnt work returning permission denied!?

why is that 775 means that the group's user can delete it just like 664 for files.




 3:47 am on Sep 7, 2010 (gmt 0)

If you want to delete a directory, you effectively need change permissions to the parent directory, because the rmdir() action needs to delete one entry from the parent directory list. Therefore 775 permissions on the directory which you want to remove is not enough to remove it, you also need to set proper rights on the parent.


 7:34 pm on Sep 7, 2010 (gmt 0)

This is an issue of ownership, not file/directory permissions. If you have a script create a directory, create tools to allow the script to remove the directory. Only root can effectively change ownership, and you don't really want your FTP user *or* PHP running as root.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved