#!/usr/bin/perl -w use strict; use Authen::PAM; my $login_name = getpwuid($<); sub conversation { my @res; while ( @_ ) { my $msg_type = shift; my $msg = shift; my $ans = "put your password here"; push @res, (0,$ans); } push @res, PAM_SUCCESS(); return @res; } my $pamh; pam_start("passwd", $login_name, \&conversation, $pamh); print pam_authenticate($pamh); pam_end($pamh);