On Fri, 13 Aug 1999, Paul Black wrote:

> The second problem is that chpasswd takes its input on STDIN. Is the code
> below (currently commented out) correct to do this?

Here's the code snippet from my perl script that adds users...

#
### generate and set password for new user. Uses 'chpasswd' from the
### shadow-utils package, see 'man 8 chpasswd' for operation.
#
   $pwd = GenPassword();                 #generate their password
   open(SETPASS,"|/usr/sbin/chpasswd");  #open a pipe to chpasswd
   print SETPASS "$usrn:$pwd\n";         #feed it username & password
   close(SETPASS);                       #shut it down


Hope this helps!


===
Archive at http://www.thesite.com.au/~radiator/
To unsubscribe, email '[EMAIL PROTECTED]' with
'unsubscribe radiator' in the body of the message.

Reply via email to