Jump to content


Photo

PHP mkdir / ftp permissions error.


  • Please log in to reply
6 replies to this topic

#1 DannyTip

DannyTip
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 17 October 2006 - 08:52 PM

Im using php to create a directory on the server when a user on my script is added. Using the following..
mkdir("../client/images/".$imgdir."/", 0755);
mkdir("../client/images/thumbnails/".$imgdir."/", 0755);
All this works prefectly fine.  The problem comes when the user then tries to log in via ftp and upload files into this directory to which permission denied errors are returned.  Its possible for the user to delete the directory fine but they are not allowed to upload files into it.  Is there anyway arround this?

Im guessing its a problem todo with users where 'apache' owns the directory.  but surely the permission 755 allows any user to read/write ?

#2 rab

rab
  • Members
  • PipPipPip
  • Advanced Member
  • 155 posts

Posted 17 October 2006 - 08:56 PM

Try 766, that gives the owner of it rwx, groups rw- and others rw-. 755 is r-x, which is read and execute not write

#3 DannyTip

DannyTip
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 17 October 2006 - 09:01 PM

I tried 0766 and 0777 but the directory created still seams to be 755 according to my ftp client.

#4 DannyTip

DannyTip
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 17 October 2006 - 09:44 PM

After some playing around and realising i was uploading the wrong file  :'(

766 is producing a chmod of 744
777 is producing a chmod of 755
666 is producing a chmod of 644

#5 rab

rab
  • Members
  • PipPipPip
  • Advanced Member
  • 155 posts

Posted 17 October 2006 - 09:50 PM

Odd, i tried this on my linux box via phpcli

<?
	mkdir( "test", 0766 );
	exec("touch test/testfile");
?>
[~] $ php t.php
[~] $ ls -al
drwxr--r--   2 rab  users  4096 2006-10-17 17:46 test
[~] $ ls -al test
total 8
drwxr--r--  2 rab users 4096 2006-10-17 17:46 .
drwxr-xr-x 58 rab users 4096 2006-10-17 17:46 ..
-rw-r--r--  1 rab users    0 2006-10-17 17:46 testfile


Wierd how it's drwxr--r--  when it should be drwxrw-rw- but the file still wrote

#6 DannyTip

DannyTip
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 17 October 2006 - 11:02 PM

Still nothing :(

#7 DannyTip

DannyTip
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 20 October 2006 - 08:25 PM

I guess ill have to create the directory via ftp using php instead.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users