Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
  • The most straightforward way to prevent something from being accessed with a browser is to not put it in a web-accessible directory. Under most default Linux/Unix configurations, that means putting it somewhere which is not under /var/www, /var/html, /var/httpd, or /home/(any user)/public_html.
  • You can set the file to be owned by the user and/or group that you want to have sole access to it, then only give read and execute permissions to that user/group. If the file can't be read or executed by the user the web server runs as, then the web server can't make it available to remote users.
  • There are various ways for the Perl code to detect whether it's being run under a CGI interface and/or whether it's being run on the command line, some of which are described in this StackOverflow question and its answers.
  • If you turn off CGI support in your web server configuration (e.g., for apache, disable mod_cgi to turn it off globally, or set Options -ExecCGI to disable it for individual directories), then it will not be possible to run the Perl code, although it will still be possible for users to view the source file unless other measures are taken as described above.

In reply to Re: forbidden perl script by dsheroh
in thread forbidden perl script by bigup401

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-20 07:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found