FRIHOSTFORUMSSEARCHFAQTOSBLOGSCOMPETITIONS
You are invited to Log in or Register a free Frihost Account!


CHMOD Checker





DanielXP
I want to check files and directorys on the internet for the chmod

so if the file CHMOD = .....
then $ok = true

can some on do this for me?

thanks
S3nd K3ys
Um.









I could do it. I'm not going to do it. That would likely be against the rules. I can think of 2 reasons one would want to do this, and the acceptable reason is not likely to be the one you intend to use it for. Rolling Eyes
DanielXP
I don't under stand

I want to release a script i made but in the install doc i need it to check a few file permissions.

whats wrong with that?
hexkid
DanielXP wrote:
I want to check files and directorys on the internet for the chmod

so if the file CHMOD = .....
then $ok = true

can some on do this for me?


What do you mean "on the internet"?
Anyway, have a look at fileperms().

Code:
$ok = false;
if (fileperms('file_to_check') == 0777) $ok = true;
DanielXP
hexkid wrote:
What do you mean "on the internet"?


Don't have a clue

hexkid wrote:
Code:
$ok = false;
if (fileperms('file_to_check') == 0777) $ok = true;


Thanks Smile
DanielXP
i keep getting this error

Warning: chmod() [function.chmod]: Operation not permitted in /home/....../public_html/...../install/index.php on line 51
hexkid
DanielXP wrote:
i keep getting this error

Warning: chmod() [function.chmod]: Operation not permitted in /home/....../public_html/...../install/index.php on line 51


http://www.php.net/chmod wrote:
Note: The current user is the user under which PHP runs. It is probably not the same user you use for normal shell or FTP access. The mode can be changed only by user who owns the file on most systems.


In my opinion it's a very good thing that the user running the webserver cannot change the file permissions. Maybe you should rewrite your script such that it doesn't need write access to index.php ...
DanielXP
No thats just the installion if the files and directos are not what they should be it will make the it

also mine keeps saying

Config.php is not writable (CHMOD to 777)
Settings.php is not writable (CHMOD to 777)
Backups/ is not writable (CHMOD to 646s)
Uploads/ is not writable (CHMOD to 777)

althought they are
S3nd K3ys
Daniel, IMNSHO, it would seem being able to have a script to scan a web site's files for chmod status would be an easy way to find targets for hacking. Wink
hexkid
Can you run this script?
Code:
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');

header('Content-Type: text/plain');

$f = @fopen('lstest', 'wb');
if ($f) {
  fwrite($f, "test\n");
  fclose($f);
} else {
  echo "Unable to create 'lstest' file.\n\n";
}

echo `ls -l`; /* ATTENTION: these are backticks! */
?>


When I run it on my "root" directory on frihost, it complains that it can't create the 'lstest' file and all the files displayed are owned by me
Code:
...
-rw-r--r--    1 hexkid   hexkid        147 Jun 24 19:21 index.html
...
This means only me can chmod these files and that the user running the webserver does not have write access to my "root" directory.
Related topics
CHMOD Tutorial
spelling checker?
Chatroom
Spell checker
chmod
chmod
FAQ - CHMOD nedir,nasýl kullanýlýr?
CHMOD?! Help!
Can´t CHMOD subdirectories
MyBB and CHMOD with myAdmin
CHMOD 0777
CHMOD Question
[Ajuda] CHMOD
Probléme CHMOD 777
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.