Um... is that the linux "useradd" program you're trying to run from the web server? Isn't that a "root-only" activity -- and rightly so?

Only root (superuser), or a user to whom root has granted "sudo" access for the "useradd" command, is allowed to use this tool, and this is a good thing, because you really don't want just anyone to be able to do this -- certainly not the web server (which typically runs under a special user account with carefully limited permissions).

Apart from not wanting a web page where anyone can come in and create a linux user account for themselves (that would be spammer/hacker heaven!), you also really do not want a string passed in via a cgi POST to be passed directly to a command-line shell, which is what you are doing with that system call. This is another thing that malicious hackers really love to see.

Read up on taint checking in perlsec and maybe use the PM SuperSearch to look up stuff on taint checking. (I'll bet there's stuff in the Tutorials wing that will be very helpful for you.)


In reply to Re: cgi script error by graff
in thread cgi script error by adam_blackice

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.