Jump to content

Recommended Posts

Posted

yes it is.. basically, i did a test by doing:

 

 

/public_html/testfolder/

 

I chmod public_html to 777

 

and the test script is inside it

 

with this:

 

<?

chown("testfolder/", nobody);

chmod("testfolder/",777);

?>

 

 

you can see here

 

http://eubankers.net/test.php

Posted (edited)

Yes but PHP can not chmod testfolder unless public_html is chmodded to 777.

 

try

 

><?
if (@chown("testfolder/", nobody))
  echo 'Owner changed<br>';
else
  echo 'Failed to change owner<br>';
if (@chmod("testfolder/",777))
  echo 'Folder permissions changed';
else
  echo 'Failed to change permissions';
?>

Edited by carbonize
Posted

done.

 

i did chmod 777 the public_html folder

lrwxrwxrwx 1 0 0 11 May 12 02:53 www -> public_html

 

same problem:

 

Failed to change owner

Failed to change permissions

 

 

 

ty

Posted

it ried full path, same problem:

 

<?

 

 

if (@chown("/home/eubfnco/public_html/testfolder/", nobody))

echo 'Owner changed<br>';

else

echo 'Failed to change owner<br>';

if (@chmod("/home/eubfnco/public_html/testfolder/",777))

echo 'Folder permissions changed';

else

echo 'Failed to change permissions';

?>

Posted (edited)

Try it on a folder within testfolder.

 

Failing that have a look at php.net/chmod where someone has posted the code to do it by FTP.

Edited by carbonize
Posted

hi got a reply from support:

 

 

The files/folders you are trying to perform chmod/chown should be under the ownership of Apache (nobody).

 

 

 

 

thanks to tina.

 

hmm so my problem now is that i'll need to first chown the folder to nobody from ssh before i can chmod it.

 

or..

 

i'll need to have php create the folder first so that it owns it and then i can chmod it.

 

ty

Posted

You can't "chown" as a regular user. If you want existing files to have ownership of nobody, you will have to submit a helpdesk ticket.

 

Also, just a word of caution, having public_html with 777 permissions is not a wise idea for security reasons. Any compromise on your site at all, and they can change anything within your website. If you only need to have your script be able to write to "testfolder" you can set testfolder to 777 and leave public_html as 755.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...