Hi Salva,

thx, but the installed sudo version does not have -S option. so i am not sure 
how will i then pass the password....

CU Sudo version 1.5.7p2

sudo -V | -h | -l | -v | -k | -H | [-b] [-p prompt] [-u username/#uid] -s | 
<command>



________________________________
 From: Salvador Fandiño <sfand...@yahoo.com>
To: beginners@perl.org 
Sent: Sunday, January 22, 2012 11:08 AM
Subject: Re: Net::Openssh and sudo?
 
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/

Reply via email to