username passwd expect



Hello All,

I have an array where @array[0] contains all the usernames and
@array[1] contains the corresponding passwds. I am trying to use the
expect module to send the passwd when prompted for passwd. I have the
following so far, but i'm not sure if i am approaching this the right
way. And the syntax for the expect object doesnt seem to be right
either. Any suggestions? Thanks

use strict;
use Expect;

foreach my $val($values[0]){
system `useradd $val`;
system `passwd $val`;
my $exp = new Expect;
$exp->send("$values[1]");
$exp->send("$values[1]");
}

.



Relevant Pages

  • Re: perl expect passwds
    ... expect module to send the passwd when prompted for passwd. ... $valuesis a reference to an array, and you want to iterate over ... Please read: perldoc -q quoting ...
    (perl.beginners)
  • perl expect passwds
    ... I have an array where @arraycontains all the usernames and ... expect module to send the passwd when prompted for passwd. ... my $exp = new Expect; ...
    (perl.beginners)
  • Re: shell scrpt
    ... NIS, in which case you need to use "ypcat passwd", others use the passwd ... comm -13 currentlyon usernames ...
    (comp.unix.shell)
  • Re: username passwd expect
    ... expect module to send the passwd when prompted for passwd. ... my $exp = new Expect; ... What Onnie needs is, obviously, to first get username and passwd into appropriate variables. ... 'Retype new UNIX password: ' ...
    (comp.lang.perl.misc)
  • Re: username: maximum length and valid characters
    ... In article, Ted Unangst wrote: ... >> And what are valid characters for usernames ... > man 5 passwd: ...
    (comp.unix.bsd.openbsd.misc)