Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Re: Stupid newbie question - perl/cgi

by Juerd (Abbot)
on Apr 03, 2002 at 05:49 UTC ( [id://156243]=note: print w/replies, xml ) Need Help??


in reply to Re: Stupid newbie question - perl/cgi
in thread perl/cgi question: script works from unix command line, but not web page

The solution? try chmoding the cgi script 777 and then run it.

Leaving the script at 0777 is very foolish. Do try this solution, but if it works, immediately re-set the file permissions to something harmless like 0744, and learn about unix permissions before you set it to something that works again.

The number 0777 may not mean a thing to you, so here's a small explanation: it allows everyone to run the file, read the file or change the file. When someone else changes the file, and you execute it, there might be disastrous results.

mt2k, please do never recommend 0777 as a mode for ANYTHING, as it's insecure. For executable scripts, 0755 should always be enough: that lets only yourself change it, but everyone can read or execute it.

U28geW91IGNhbiBhbGwgcm90MTMgY
W5kIHBhY2soKS4gQnV0IGRvIHlvdS
ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
geW91IHNlZSBpdD8gIC0tIEp1ZXJk

  • Comment on Re: Re: Stupid newbie question - perl/cgi

Replies are listed 'Best First'.
Re: Re: Re: Stupid newbie question - perl/cgi
by mt2k (Hermit) on Apr 04, 2002 at 05:34 UTC
    Aha, there is a reason, however, why I suggested 0777 as the permission for scripts.
    The server I am working on is setup in a bad way.
    Whatever permissions are set for the script are the same permissions my scripts are granted for files.

    If I chmod the script 0755, then my script can read and execute files, but it cannot write to files!!
    If I chmod it to 0777 it can read, execute, and write to/from files.

    This is a very strange behaviour, but it is how the server I am on works. So to be able to write to files, I HAVE to chmod my scripts to 0777.

      So to be able to write to files, I HAVE to chmod my scripts to 0777.

      I would have refused to work with such crap. If any other user on the machine, and badly set up machines tend to have a lot of users, adds system qw(rm -rf), $ENV{HOME}; to your script, you will be fried on its first run.

      U28geW91IGNhbiBhbGwgcm90MTMgY
      W5kIHBhY2soKS4gQnV0IGRvIHlvdS
      ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
      geW91IHNlZSBpdD8gIC0tIEp1ZXJk
      

        That is the strange part I believe.

        The actual user directory is chmoded differently, so that access to the www-root directory is inaccessible. Meaning that they could not edit should they want to. Sure, the file itself is 0777, but the parent directory is 0722 or something less.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2024-04-23 07:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found