Greetings,

I have a perl script that is using telnet that I need to switch to SSH
and I'm having some issues. First is I need to use sudo to run the
command on the server I'm connecting to and second I need to run more
then one command, I'll then save all this output.

I have this so far but it is not allowing sudo, just wondering if it is
NET::SSH or that RSA type of SSH we are running?  I have tried to pass
numerous commands but that doesn't seem to work, how can I run numerous
commands via the single SSH connection?

#!/usr/bin/perl
use Net::SSH qw(sshopen2);
use strict;

my $user = "ops";
my $host = "prserver07a";
my $cmd = "ls -al";
my $cmd2 = "sudo opcagt";

sshopen2 ("[EMAIL PROTECTED]", *READER, *WRITER, "$cmd2")  || die "ssh: $!";

while (<READER>) {
        chomp();
        print "$_\n";
}

close (READER);
close (WRITER);



Thanks

Bill

Reply via email to