I'm not a perl guru, and this is off the top of my head, but did you try
something like this:
#!/bin/perl
open(PIPE, "|smbpasswd")
print PIPE "$oldpassword\n"
print PIPE "$newpassword\n"
print PIPE "$newpassword\n"
close PIPE
regards,
Rob Coward
>------------------------------
>
>Date: Fri, 29 May 1998 15:54:42 -0500
>From: "Davenport, Todd S. " <davent@eglin.af.mil>
>To: samba@samba.anu.edu.au
>Subject: Encrypted passwords
>Message-ID:
<F4879964EE05D1119EFE00A0C96F7FBE01348D84@scnt05.eglin.af.mil>
>
>Is there a tool, either for Perl or C, that will add/change the NT and
>LM encrypted passwords in the smbpasswd file? I know about the
>smbpasswd command, but I can't use that function from a script. I tried
>
>#!/bin/perl
>system("smbpasswd \<
$oldpassword\n$newpassword\n$newpassword\n");
>
>
>and some other things, but I couldn't get it to work.
>
>