Step 1 - Find out the user name and group that the web server is running under.

ps -ef | grep httpd # this will show you the user id of the web server

Step 2 - Find out the permission of the directories and files you are trying to read from and write to.

ls -al /my/path

Step 3 - Change the group of your directory and files to the httpd user group, and set group read/execute permission on the directories and files.

# httpd group (you can find out from the /etc/password # and /etc/group files chgrp -R httpd /my/path chmod -R g+rx /my/path

Step 4 - Well, test again.

su - httpd # set uid to httpd user, assuming that you are the # root user and no password is required # run your cgi script from the command line. # you don't need to use a browser to test the cgi script.

By the way, you do have root access to the system, don't you?


In reply to Re^3: system call in cgi/perl script on linux by Roger
in thread system call in cgi/perl script on linux by roseberry123

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.