Hello folks,
I have recently moved from Net::SSH:Perl (which was a pain in the btt to install on solaris with no internet connection plus it would eat up my CPU when used because of Math::Pari which would not find the porper C library and would thererfore switch to a less performing perl library to do its job) to Net::OpenSSH.
Net::OpenSSH actually installs quite nicely but since I am using it, the ssh welcome message (the logon banner if you wish), which normally appears when you logon with ssh client manually, now appears in the script's STDERR.
The situation looks like this:
- Net::SSH::Perl: no trace of the SSH logon banner
- Net::OpenSSH: SSH welcome message goes to STDERR which in turn gets redirected to an error log file which gets filled with crap like:
"This system is for the use of authorized users only.
Individuals using this computer system without authority, or in excess of their authority,
are subject to having all of their activities on this system monitored
and recorded by system personnel."
see below the sample code which causes this:
my $ssh = Net::OpenSSH->new(
$remote_host,
(
ssh_cmd => '/usr/local/bin/ssh',
user => $user,
password => $pass
)
);
my $command = '/bin/ls -l';
my ($out, $err) = $ssh->capture2($command);
chomp $out;
undef $ssh;
Any idea why this happens ?
As a workaround, just before using OpenSSH I redirect STDERR to /dev/null (open STDERR, '>/dev/null';) and I close it when the SSH stuff is over.
That seems to work.
Thanks in advance
Max
PS This is my first question on perlmonks. I did my best to desccribe my problem in a brief but precise way so that others here may understand it.
If my behavior is somehow violating the ground rules of the forum please advise.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
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.