Hi, I am developing a CGI script and am looking for a way to allow users to log into it and have certain privlidges once they do. However, every time I look into a method for authenication, I keep finding holes. First, I tried using a password file to keep username/password pairs. Then, when a user logs in, I would check to see if the username exists and the password is correct in the password file and then I would set a cookie (with the username and password). For every subsequent page, I would read the cookie and compare it to the password file to see if the user exists and the password is correct. Perhaps leter, I will hash the passwords with MD5. However, then I found out about CGI::Session. After learning about this and crudely implementing it, I found out that everyone who has a login to the server can read the session data in the /tmp directory. So basically, I have a choice of having a world readable password file (since the apache user needs to be able to read it) or a world readable session file in the /tmp directory. Does anyone know the preferred method for storing username/password paris to allow a user access to only what they should have access to and still be secure on the server? Note: I am using a public server (one for which I do not have root), but have found a way to add needed modules within my program directory. I would be very greatful for any advice. Thank you for reading this. Joe

2004-05-05 Edit by jdporter: Changed title from 'Module relocation'


In reply to CGI and saving passwords by JoeJaz

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.