Jump to content


This topic is now archived and is closed to further replies.


new directory on cifs share permission problem

Recommended Posts

I have a very odd problem, but i'm sure the members of phpfreaks can help.  I have a linux server running PHP 5.1.  I mounted a windows filesharing using cifs.  The mounted directory is owned by www, my web service user.  I'm using PHP to create a directory (mkdir($dir, 0777) on the share and store files in there.  When i write them, i get a file permission error.  When i look at the permssions, i see it is own by root, even through it was created by php (www).

drwxr-xr-x 2 root root 0 Sep 22 16:11 new_dir

I understand why its not writable.  www can't write to this.  However, the interesting thing is, when i run the script again, and it doens't have to create the directory, the files store.  after the second run, the permissons change to:

drwxrwxrwx 1 root root 0 Sep 22 16:26 new_dir

Also, the colors in bash change to green/white, and dircolors say its: "STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)"

Why is it creating a directory owned by root.  and then why do the permissions change?  I'm doing nothing to change the permissions.  i just check if the dir exists, create it if it doesn't, and write files to the new dir.  Is it something w/ the way i mount the share?


Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.