in reply to user authentication using unix password file

Note that crypt and getpw* won't work because some systems store passwords in /etc/shadow, and/or use MD5 to encrypt them (and the crypt function doesn't behave accordingly). Sometimes passwords might be managed off machine.

You'll find the Authen::PAM module helpful if your system supports PAM (Pluggable Authentication Modules). Otherwise, Crypt::PasswdMD5 might be useful, as well as looking up the documentation for what fields are in /etc/shadow.

If your system uses shadow passwords it is likely that your script will need to have root access. Regardless, you have a serious security issue if people can try to brute-force passwords on your system through your script.

Replies are listed 'Best First'.
(tye)Re: user authentication using unix password file
by tye (Sage) on Jun 11, 2001 at 21:31 UTC

    Update: On rereading, I've decided that mine isn't a very useful reply. /:

    Actually, even on many systems with shadowed passwords, either the C library's getpw*() or Perl's wrapper will grab the shadow encrypted password when the routine is called by a process with effective user ID of 0 (root).

            - tye (but my friends call me "Tye")