develooper Front page | perl.beginners | Postings from January 2012

Net::Openssh and sudo?

Thread Next
From:
Rajeev Prasad
Date:
January 20, 2012 11:10
Subject:
Net::Openssh and sudo?
Message ID:
1327086649.65748.YahooMailNeo@web114201.mail.gq1.yahoo.com


hello,

using Net::Openssh how can i use sudo to become some other user (say root) on a target machine and then execute a series of commands as root?

i looked and tried to use the expect example given on Net::Openssh page but could not make it to work.

my $myssh  = Net::OpenSSH->new($host,
                                port => $SSHPORT,
                                user => $USER,
                                password => $PASS,)

now how can i execute a sudo on this, thus becoming a different user and, then execute bunch of commands on this handle?

please advice.

thank you.
Rajeev


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About