Forum Moderators: coopster
Also i thought maybe I would just create a second file which is called to change the permissions of the file temporarally, which already has root ownership. Is there issues with this method?
Thanks,
Ryan
Allowing everyone to read and write to a file is never a good idea.
So if you have to use 666 then try the following -
Use a file name that is unlikely to be guessed i.e. if this is some form of admin file then dont call it admin.php...call it asdfjklhj897askj.php or some other random string.
Dont have a link to the file in the source code. Put the link in the php so that no one can see it.
If there is no other way then maybe you could require a password to use the file (apache mod_auth), then send the password to the url using the header function. So long as the contents of that file are not sent directly back all of that internal php processing should not be seen by the browser.
As with everything security wise it all depends on what information you are hiding from people.
A few dodgy pics of friends...not so bad, financial/medical records then this is not really good enough security.
chown root file¦directory
The whole idea somehow feels like there is something wrong in it, but I can't understand why changing the permissions is not a good idea.
If you think changing the ownership is not a good idea, what do you suggest?
[edited by: Habtom at 12:21 pm (utc) on Oct. 31, 2007]
can that be changed via ftp? will that help?
can you just create the file using php, there by allowing writing by php files?
can you write to another file, using php, and then have a cron with proper perms append to the other file at some interval
I have no clue what file this might be or why the permissions are wrong but seldom are you locked into a position where you need to get around permissions, you usually just aren't going about it properly.
maybe your host is just a joker? ;)
Is it possible to (maybe in a .htaccess file) to set the user to "root" everytime that script is run? Or is this another silly security mistake?
Thanks,
Ryan
can this be done via the .htaccess file. forcing 1 single script (the one doing the read/writing) to run as the specific username?