PDA

View Full Version : scripts... what are they permission-wise?


dj-power-n-assoc
06-02-2002, 03:23 PM
Running, say, Script One (in this case, PHP script, in http://localhost) and it doesn't have permissions to run Script Two, what do I do to fix it?

And this leads to a larger, encompassing question: what type of user is a web user regareded as? Group? Everyone?

Back to specifics... here's the error I'm getting with Script One and Two:

Warning: fopen("forum/1_misc.xml", "w") - Permission denied in /Library/WebServer/Documents/forum/class_forum.php on line 442


An overview would be extremely welcome :) Sorry if the Subject line is weird-sounding... I don't know how to ask the question.
:confused:
dj

bakaDeshi
06-03-2002, 03:32 AM
group is www. launch NetInfo, and browse through groups and users for listings. Permissions for scripts are usually 755 which would look like so -rwxr-xr-x 1 kennsan admin 183 May 15 01:42 first.cgi*
Although, you're error looks like you need write permission(I could be wrong). If you need write permission, then you'll need to add that as well. chmod o+w. Unless I'm not understanding you're problem, you'll have to provide more details.

-HTH

dj-power-n-assoc
06-03-2002, 01:59 PM
So when a web user hits Page.php and that page needs to write to File.xml, File.xml's Groups needs write (w) permission?

(As opposed to Owner or Everyone.)

When you say 'group is www' don't you mean 'www is group?' The way I think of it is it would be the second of the two. Are you speaking about group as in Owner, Group, Everyone?

I'm at work now, on a PC, don't have Netinfo manager.

Thanks,
dj

bakaDeshi
06-04-2002, 11:17 AM
'www is the group', I think you're right, although my mind is probably just a little twisted and backwards.;) The user is also called 'www' which belongs to the group 'www'. So, if you need your script to write to a file, the permissions need to be correct on the file to allow the user('www') which belongs to group('www') to be able to write to that file. So you need to add write permissions to the file. If the file was created by you, then it probably is owned by you.-rw-r--r-- 1 kennsan staff 0 Jun 4 11:01 myFileSince 'www' doesn't belong to group 'staff', you need to add write permissions for Others.[localhost:~/Public/weblogs] kennsan% chmod o+w myFile
[localhost:~/Public/weblogs] kennsan% l
-rw-r--rw- 1 kennsan staff 0 Jun 4 11:01 myFile
You can also change the owner to 'www' if noone else needs to edit the file, such as logs.-rw-r--r-- 1 www staff 207 May 23 12:32 bonus.txt

Basics(ignore if too basic)-rwxrwxrwxFirst char indicates the type of file(plain(-), directory(d)). 1st group of 3 - Owner's perm, 2nd group - Group's perm, 3rd group - Other's perm.

So with all this babble, somewhere in here maybe I've answered your question.:D I guess it all depends on the file's original permissions, i.e. who owns it what group they belong to, etc. This will determine where you set write permissions to give access to your script.

-HTH