> To preface this, let me say that I am a system administrator 
> responsible for creating and modifying User accounts on a 
> Unix system. 
> 
> Is it possible to make a Perl script to change passwords 
> using the passwd command without having to get and answer 
> those prompts??? I have tried opening a process filehandle 
> (as documented on Pg 201-202 in "Learning Perl 3rd edition') like so:
> 
> my $user="dingbat";
> open PWD,"|passwd $user";
>  
> also 
> 
> open PWD,"passwd $user|";
> 
> also 
> 
> open PWD,"|passwd $user|";
> 
> and then do a 
> 
> Print PWD "password";
> Print PWD "password";
> 
> which is supposed to answer the prompts.
> 
> None of them seems to work. Am I doing something wrong? I 
> think you can do something like this in expect, but we are 
> not allowed to install that. 
> 
> Will Perl do the above or not? Any help would be appreciated.

Hmm I'd think passwd would be failry tough to answer a prompt for due to security 
unless there's a swich which lets you provide the password in the command. I handle 
,htaccess files that way

print qx(/usr/bin/htpasswd -b $file $user $pass);

Last I remember passwd doesn't have that type of option.
You might try to do that with the pw program if passwd won't do it.

Otherwise the joys of "typing" in other program's prompts is really fun. 


HTH

DMuey

> 
> .
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to