Forum Moderators: coopster & phranque

Message Too Old, No Replies

Im back!

CHMOD help

         

Knowles

12:43 am on Jun 2, 2002 (gmt 0)

10+ Year Member



Here awhile back I came in looking for help on a server log. I got it all working but then my server went through and changed settings on the server. Now the folder it is in resets its user status like every min. So I can go in and CHMOD it back to say 777 so I can pull the log but then when I refresh to see any changes it gives me:

Warning: file("../logs/pserver.log") -
Permission denied in /home/palacehosting/secret/web/log.php on line 3

So I went to php.net sure I was going to fix this on my own and not have to ask for help again. They said use the chmod()
So I added this text above the call for the log:

chmod ("../logs", 0777);

But now I get this when I refresh:

Warning: chmod failed: Operation not permitted in /home/palacehosting/secret/web/log.php on line 2

Warning: file("../logs/pserver.log") - Permission denied in /home/palacehosting/secret/web/log.php on line 3

I saw on the user comments on php.net about it not working unless your the same user, but when I went to chown() I didnt quite understand how to set that up. I will keep playing with it but any help would be appreciated!

Thanks
Knowles

Knowles

12:51 am on Jun 2, 2002 (gmt 0)

10+ Year Member



I have tried now:

chown("../logs", nobody);

and

chgrp("../logs", nobody);

I used nobody because I remember reading somewhere thats how PHP is considered or something.

IN both of them I get:

Warning: chown/chgrp failed: Operation not permitted in /home/palacehosting/secret/web/log.php on line 2/3

Hope this helps more

Knowles

1:09 am on Jun 2, 2002 (gmt 0)

10+ Year Member



I changed chown() to:

chown ("/home/palacehosting/secret/logs/", apache);

but it goes back to the orginal chmod result saying not allowed. I found the apache as the user from doing phpinfo() so I assume that is correct.

DrDoc

3:29 am on Jun 2, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you tried doing chmod/chown directly from the shell prompt?

Duckula

4:44 am on Jun 2, 2002 (gmt 0)

10+ Year Member



He won't: changing to user Nobody requires privileges.

A thread not so long ago suggested to SUID the script that will call the commands as mode 4777 with owner/group the owner of the files that will be modified by the script.

Be aware: using a SUID script will be a security compromise, because if the script is cracked into the attacker will have the owner privileges and not the ones of Nobody; that is why the Nobody user exists in first place and why some operations are forbidden for it.

Knowles

4:02 pm on Jun 2, 2002 (gmt 0)

10+ Year Member



I plan on putting security in it if I can ever get it to work. I am thinking they have blocked the usage of it however. Since it is giving me Operation not permitted. Ill let yall know if I figure it out.

TeddyBare69

4:13 pm on Jun 2, 2002 (gmt 0)



If I could add my two cents.

If you do an 'ls -l /home/palacehosting/secret/web/log.php' this will tell you what user owns the file. From the way it sounds you might have already done that and the owner is apache. Your next step would be to contact the person who starts the apache server and find out how you can get read permissions to this log file. I didn't read if you had said that this worked before and now it doesn't work? The best solution is to ask the owner of the file to give you permissions instead of using chmod to give yourself permissions.

I hope this helps.

Knowles

2:42 pm on Jun 7, 2002 (gmt 0)

10+ Year Member



Thanks for the suggestion TeddyBare69, unfortionatly its kinda hard to contact them. I am on an intrum server of sorts. I am trying to help a friend get one set up to move to but had to have one for now which I dont really care for but what I need the choices are kind of limited since most vurtual hosting wont work and I cant afford dedicated.