When I submitted a patch for Apache's auth module to make it work with /etc/passwd, they politely declined it. Apparently, they had received dozens of submissions like this, but were against it in principle. Using "system" passwords for Web-based management is a capital-B Bad Idea, for security reasons, and many others.

Now, this was some time ago, back when /etc/passwd actually had "passwords" in it. Most systems now use /etc/shadow to store the encrypted passwords, which means that the CGI user cannot actually read this information. Otherwise, you would have to run your CGI as root, which is an Exceptionally Bad Idea.

As wog was kind enough to mention, PAM might give you the access you require, and I would certainly look into using this.

Remember, though, that disclosing your system password is highly dangerous. If, for some reason, a user's password were captured, and this user happened to have "sudo" access (a utility to run root-level commands and/or a root shell), then you are exposing yourself to a world of hurt. All it would take is one of your admins to log in to your Web page from a cable modem connection which happened to have a "sniffer" on it, and your system would be, as they say, chown'd. As in, no longer yours.

Perhaps if you could describe the nature of your application, some ways of addressing this particular requirement could be investigated.

In reply to Re: user authentication using unix password file by tadman
in thread user authentication using unix password file by Anonymous Monk

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.