On 01/20/2012 08:10 PM, Rajeev Prasad wrote:
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?
Have you see the FAQ entry "Running remote commands with sudo" on the
module documentation?
https://metacpan.org/module/Net::OpenSSH#FAQ
It describes a simple way to run commands with sudo that doesn't require
Expect.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/