On Mon, 17 Oct 2005, O'Brien, Bill wrote: > 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?
Stepping away from Perl for a moment, if you're trying to have ssh run an interactive command, such as sudo, then you have to allocate a tty for that command to interact within. With the ssh command, you have: $ man ssh | grep -i '\-[a-z] .*alloc' -T Disable pseudo-tty allocation. -t Force pseudo-tty allocation. This can be used to execute arbi- $ Therefore, you can do things like: $ ssh -t [EMAIL PROTECTED] "sudo ls -al" This will connect to $host and issue the command; sudo will then come back over the ssh connection and ask you to authenticate; once that is done, sudo will then proceed as normal. So, to get back to your question, I think what you need to do is figure out a way to pass the -t argument to ssh via Net::SSH. Skimming over the perldoc at <http://search.cpan.org/dist/Net-SSH/SSH.pm>, it looks like you might be able to use the ssh_cmd() method to set this up. Look up the section that mentions OPTIONS_HASHREF for hints, and good luck! -- Chris Devers ÷0~g±ê
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>