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

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.

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

Replies are listed 'Best First'.
Re: Re: Re: Re: Stupid newbie question - perl/cgi
by Juerd (Abbot) on Apr 04, 2002 at 05:45 UTC

    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.