jt_exist has asked for the wisdom of the Perl Monks concerning the following question:
Basically my problem now are: 1) I'm not allowed to install another module(politics/not rights). 2) I don't have idea how to send/supply password after the execution of $cmd and the prompt will come out.#!/usr/bin/perl use strict; use warnings; use Net::SSH::Perl; use Expect; my $logs = "logs"; open(LOG,'>>',"$logs") or die "can't logs $!\n"; my $domain = 'domain.com'; my @host = qw/host/; foreach my $host (@host) { my $cmd = "passwd user1"; my $sshost = join('.', $host, $domain); my $ssh = Net::SSH::Perl->new("$sshost"); $ssh->login('root'); $ssh->debug(); my ($stdout, $stderr, $exit) = $ssh->cmd($cmd); print LOG $stdout,"\n"; }
|
|---|