Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: user authentication using unix password file

by marcink (Monk)
on Jun 08, 2001 at 02:24 UTC ( [id://86789]=note: print w/replies, xml ) Need Help??


in reply to user authentication using unix password file

Assuming your machine is using crypt: yes, it's easy though on most systems you'd need /etc/shadow, which usually is readable only by root.

Anyway, the code:

#!/usr/bin/perl -w use strict; my $crypted_passwd = 'SqL9sEYFbjX0U'; my $clear_passwd = 'blah'; my $seed = substr( $crypted_passwd, 0, 2 ); print "It's correct\n" if crypt( $clear_passwd, $seed ) eq $crypted_pa +sswd;

Update: Oops, misunderstood your question. Seems like serious caffeine shortage.

The proper answer would probably be: use Authen::PAM ;-)

-mk

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://86789]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-19 02:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found