in reply to Re: Shadow Passwords
in thread Shadow Passwords

The Linux passwd supports the --stdin option to read the password from stdin. This should be easy to automate with Perl. Using passwd means that PAM handles changing the password and it knows the current configuration of shadow, MD5, etc.
system("useradd $user"); open PASSWD, "| passwd --stdin $user"; print PASSWD $password; close PASSWD;