1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#!/usr/bin/perl use strict; use warnings; use 5.010; system('cls'); say "bin in Zeile ".__LINE__; use Net::OpenSSH; $Net::OpenSSH::debug = ~0; # alle debugging flags einschalten https://metacpan.org/pod/Net::OpenSSH#DEBUGGING say "bin in Zeile ".__LINE__; my $ssh = Net::OpenSSH->new('host .com', user => 'user', password => 'pw' ); say "bin in Zeile ".__LINE__; $ssh->error and die "Couldn't establish SSH connection: ".$ssh->error; say "bin in Zeile ".__LINE__; my ($out,$err) = $ssh->capture2({timeout => 5},"cd /www/verz") or die "remote command failed: ".$ssh->error; print "THE OUT IS $out\nTHE ERROR IS $err\n"; say "bin in Zeile ".__LINE__;
1
2
3
4
5
bin in Zeile 8
bin in Zeile 11
# open_ex: ['ssh','-V']
# io3 mloop, cin: 0, cout: 1, cerr: 0
# io3 fast, cin: 0, cout: 1, cerr: 0
perldoc Net::OpenSSHKnown issues
Net::OpenSSH does not work on Windows. OpenSSH multiplexing feature requires passing file handles through sockets, something that is not supported by any version of Windows.