If you wish this to be easily scalable, use the tools the system supports or go with a real database.

In many server setups, the users are not listed in /etc/passwd or /etc/shadow at all. It is even more common for a user who doesn't have shell access to not have a home directory either.

Your system's getpwnam(), which Perl will call when you use the Perl function by the same name, knows how to get the info about your users whether you use /etc/passwd, an LDAP server, PAM through an SQL server backend, etc. If you don't want to use the system call, then store your user data in a real database -- or at least in a DBD::SQLite, DBD:CSV, or DBD::RAM database -- for future scalability and ease of changing the backend.

One advantage of using a DBI midend for this is that you can change from a plain file to MySQL, PostgreSQL, DBD:LDAP, Oracle, Sybase, etc. with little or no change to the code. One advantage to using getpwnam() is that you can change your system from using password files to using LDAP to using whatever other authentication backend your system supports with little or no change to the code.

Christopher E. Stith
use coffee;

In reply to Re: User Existance? by mr_mischief
in thread User Existance? 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.