Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

perl parallel script

by amagana (Acolyte)
on Mar 27, 2015 at 22:41 UTC ( [id://1121578]=perlquestion: print w/replies, xml ) Need Help??

amagana has asked for the wisdom of the Perl Monks concerning the following question:

I ran this script "parallel_passwd.pl" from a linux box and I wanted to change my password on a solaris 10 server but after I enter the old password and new password I get nothing back, not even a timeout or error. I run the perl script like this: perl ./parallel_passwd.pl -l mylogin remoteserver https://github.com/salva/p5-Net-OpenSSH-Parallel/blob/master/sample/parallel_passwd.pl

Replies are listed 'Best First'.
Re: perl parallel script
by LanX (Saint) on Mar 27, 2015 at 23:37 UTC
Re: perl parallel script
by frozenwithjoy (Priest) on Mar 28, 2015 at 04:16 UTC

    After you run the script, run the following:

    echo $?

    Based on the change_password() subroutine, I expect you will get the value 1 back indicating there is an error and something doesn't match.

    sub change_password { my ($host, $ssh) = @_; my ($pty) = $ssh->open2pty('passwd'); my $expect = Expect->init($pty); $expect->raw_pty(1); # $expect->log_user(1); if (answer_passwd($expect, 'current.*:', $old) and answer_passwd($expect, 'Enter new.*:', $new) and answer_passwd($expect, 'Retype new.*:', $new) and $expect->expect($timeout, "success")) { exit(0); } exit(1); }

    Also, I'm wondering if this script will ever work as is, since it seems like it will always exit before it completes its 'mission'. Perhaps you could change that subroutine to by deleting the exit() statements or changing exit(0); to return;.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1121578]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (1)
As of 2024-04-25 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found