chmod() & chown() problems
I'm gaving some difficulty getting my head around "Permissions".
In my public_html folder, I have two directories, one called 'standard' and the other called 'configs'.
In configs, there's a script called 'makeone.php' that creates a directory in public_html, and then copies the contents of 'standard' into the new directory. It then creates a file in configs.
Or at least that's what it's supposed to do.
If I set permissions to 0770 in public_html, and 0777 in configs, then I can create the required directory and write the file into configs.
If, when I create the folder in public_html, I set it to 0777, then I can copy from standard to the new folder.
If I set the permission of the new folder back to 0755 on completion, then my ftp software (filezilla) can't delete the new folders, or change permissions.
This raises a number of questions, not least is one of security.
I think it comes down to ownership, in that the "owner" of the php installation is different to the owner of the domain space (shared server).
If that's correct, how do I get the right owner id's, and how do I transfer ownership from one to the other?
you're right - the owner of the files created by PHP is not you. however, maybe its not clear to me, but do you actually need to have write permission on these files? being able to read them should be enough for an FTP to download them.
I do need write permission.
I'm trying to automate an account creation process, and to do that, the php script, and NOT the ftp software needs to create folders, copy files and write a configuration file. The only reason I mentioned ftp was because I was using filezilla to verify that the php had behaved predictably.
The only way the script works is if public_html is set to 770 and config is set to 777.
This clearly create a security risk.
The owner of config, using fileowner() is 3xxxx and the owner of the new folders is 99.
Is there a workaround for this?
If not, what security exposure do I have at these settings?
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)