Douglas Harter wrote:
> 
> To preface this, let me say that I am a system administrator responsible for
> creating and modifying User accounts on a Unix system.

Do you have access to the books _Advanced Programming in the UNIX
Environment_ and _UNIX Network Programming_ by W. Richard Stevens?


> Is it possible to make a Perl script to change passwords using the passwd
> command without having to get and answer those prompts???

It is possible (how else could someone write the Expect module) but it
is not easy.  How much do you know about pseudo terminals?


> 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.

The first thing I checked was pipe()

perldoc -f pipe

Which refers to IPC::Open2, IPC::Open3 and perlipc.  Read the section
"Bidirectional Communication with Another Process" in perlipc for more
information.

perldoc perlipc



John
-- 
use Perl;
program
fulfillment

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

Reply via email to