Hi Salva !!!
Pity I can vote this only once. I installed your new updated module and it just works now !!!. Here is the script
#!/usr/bin/perl
use Modern::Perl;
use Net::SSH::Any;
my $hostname = '192.168.247.128';
my $username = 'perl514';
my $password = 'redhat';
my $cmd = 'ls -l';
if (my $ssh = Net::SSH::Any->new($hostname, user => $username, passwor
+d => $password))
{
say " I am connected to $hostname!!!";
my @out = $ssh->capture($cmd);
say "The files and directories of $username on $hostname are given
+ below";
say "@out";
}
else
{
say "whee...something wrong here"
}
Aand here is the output !!
I am connected to 192.168.247.128!!!
The files and directories of perl514 on 192.168.247.128 are given belo
+w
total 16
drwxrwxr-x. 2 perl514 perl514 4096 Nov 14 14:52 perlscripts
drwxrwxr-x. 2 perl514 perl514 4096 Nov 14 14:52 test1
drwxrwxr-x. 2 perl514 perl514 4096 Nov 14 14:52 test2
drwxrwxr-x. 2 perl514 perl514 4096 Nov 14 14:52 test3
You rock !!
Thing is, it took about 12 seconds for the script to ssh into the Centos VM Guest OS, but man I am glad this works !!...Is there a way to save the ssh keys and circumvate the password requirement? If the Net::SSH2 method will work (I still havent tried it) to add the ssh keys, then I'll try that out. But yeah, this works !! O yeah, by the way, I finally got rid of Windows 7 on my personal laptop....will try on that one too !! Its running Ubuntu 12.04 now, so itching to try out stuff on it :) So for work, I will be on Win 7 (And to manage the storage environment it will be Win 2003: Not my choice), but on personal laptop, its Linux all the way now.
Perlpetually Indebted To PerlMonks
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Outside of code tags, you may need to use entities for some characters:
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|