maybe try using ssh or telnet?
if you have shell access try this
'passwd username'
it will prompt you for a new pass..
otherwise you could also try perl..
#!/usr/bin/perl
print "Content-Type: text/html\n\n";
to change the pass
$command = passwd root;
not sure how you would answer the 'double' prompt it sends back, maybe with 'while'..
while($command){
send first pass
break;
}
if($command){
send second pass
exit;
}