Authen::Simple::PAM doesn't DWIM

Simon Wistow simon at
Mon Feb 18 11:32:28 GMT 2008

I have a script like

-- >8 --

#!/usr/local/bin/perl -w

use strict;
use Authen::Simple::PAM;

my $service  = 'login';
my $user     = shift || "";
my $pass     = shift || "";
my $pam = Authen::Simple::PAM->new(
        service => $service

if ( $pam->authenticate( $user, $pass ) ) {
    print "Success!\n";
} else {
    print "Fail!\n";

-- >8 --

Which, if I run it from the command line succeeds all the time as long 
as $user is the same user I'm logged in as, no matter what the password 
given is.

However, if I give another username then no matter whether the password 
is correct or not, it always fails.

Am I missing something really obvious? Is PAM not supposed to work this 
way? Is it something screwy with my FreeBSD jail set up? 

Confused of North London

More information about the mailing list