Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Opening files to write in browser returns Permission denied

by Lady_Aleena (Curate)
on May 03, 2017 at 00:47 UTC ( #1189378=note: print w/replies, xml ) Need Help??


in reply to Re: Opening files to write in browser returns Permission denied
in thread Opening files to write in browser returns Permission denied

I am talking about a script, one called sitemap.pl, that opens in my browser and displays html content. At the end of the script, I have it write a list created in the script to a file. sitemap.pl, opened in the browser, can not write to sitemap.txt in the same directory as sitemap.pl unless the text file's permissions are set to 666.

So, from what I am gathering here, I have to set write files to 666 so that the output from scripts running in the browser can write to them.

No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
Lady Aleena
  • Comment on Re^2: Opening files to write in browser returns Permission denied

Replies are listed 'Best First'.
Re^3: Opening files to write in browser returns Permission denied
by huck (Parson) on May 03, 2017 at 01:23 UTC

    How do you open sitemap.pl in your browser?

    You may find it of interest to run this

    my $user = `whoami`; chomp $user; my $groups = `groups $user`; chomp $groups; print "<br>I am running as $user in groups $groups\n";
    I suspect that the user you get back is not what you expected. I also suspect it is the last 6 in 666 that is fixing your problem. You are setting up a file that anyone can write into. Knowing what groups you are in and the perl process is running you may be able to determine what groups you may have in common. Setting that file (or directory) to be a member of that common group may mean you dont need to let anyone write to that file, but limit it to only userids in that common group.

      I did as you specified and was surprised by the result. I will have to dig into apache2 to see how can make my "localhost" local to me. Thank you huck!

      No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
      Lady Aleena

        For server-wide apache process ownership see User and Group.

        For per-vhost user/group assignments see SuexecUserGroup and the suexec tutorial.

        Make sure you fully understand the implications of using these directives before invoking them on any publicly-accessible server.

      Whether it is the first, the second, or the third... That seems to work.

      P.S. Would it be better to set the file permissions to 777? Why does evil win here?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1189378]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2019-10-22 09:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?