At Wed, 24 Jul 2002 12:37:23 +1000, Gavin Carr wrote:
>   print "Username? ";
>   $username = <STDIN>;
>   print "Password? ";
>   $userpass = <STDIN>;
>   $passwd = (getpwnam($username))[1];
>   print (crypt($userpass, $passwd) eq $passwd) ? "okay\n" : "bad\n";
> 
> This works with conventional crypt passwords and with shadows if you're
> root. I think it should work with other pamified things as well because 
> it's just calling the system library getpwnam().

you could also call the PAM libraries directly from perl (see the
relevant CPAN modules), if you wanted to do make your program fully
pamified.

i guess the real question peter is why are you doing this yourself?

a shell script verifying logins (and presumably running as root) is
not something you probably should be doing..  can you just wrap
something in sudo (or similar)?

-- 
 - Gus
-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to