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.