kbro has asked for the wisdom of the Perl Monks concerning the following question:
I have a machine on my LAN called "rocky" that's running Rocky Linux 8.5. My user id on it is also "rocky" and I've set up the appropriate ~/.ssh/config magic on my laptop to pass the username and key path to ssh so that ssh rocky whoami outputs rocky. I don't get prompted for a passphrase for the key because I've already ssh-add'ed it to my local ssh-agent.
My laptop is running Windows 10 with Ubuntu 20.03.4 LTS in a WSL1 container. The libnet-openssh-perl package is installed and gives me Net::OpenSSH version 0.78, but I've also tried sudo cpanm --install Net::OpenSSH to get version 0.80 and it doesn't fix the problem, which is this: when I run the following Perl program I get the error:-
channel_post_mux_listener getpeereid failed: Operation not supported Use of uninitialized value $_[0] in join or string at /usr/share/perl5 +/Net/OpenSSH.pm line 122. Can't ssh to rocky: unable to establish master SSH connection: at Jun +k/snaggle.pl line 17.
Actually 0.80 gets rid of the "uninitialized value" error, but I still get the "getpeerid" problem. Any suggestions? Here's the script:-
As you can see from the commented out code, I originally tried passing just the hostname and relying on ~/.ssh/config, but then tried passing the username and key_path to see if it made any difference. It didn't. Thanks for your help!#!/usr/bin/perl use strict; use warnings; use Net::OpenSSH; use constant { HOST => q{rocky}, USER => q{rocky}, KEYPATH => q{~/.ssh/broadey.net_rsa}, CMD => q{whoami}, }; #my $ssh = Net::OpenSSH->new(HOST); my $ssh = Net::OpenSSH->new(HOST, user=>USER, key_path=>KEYPATH); $ssh->error and die "Can't ssh to ${\HOST}: " . $ssh->error; my ($out,$pid) = $ssh->pipe_out(CMD) or die "Remote command failed: " . $ssh->error; local $| = 1; # enable output autoflush while (<$out>) { print time, ": ", $_; # $_ includes the \n }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::OpenSSH channel_post_mux_listener getpeereid failed: Operation not supported
by Corion (Patriarch) on Feb 15, 2022 at 08:38 UTC | |
by kbro (Novice) on Feb 15, 2022 at 14:23 UTC | |
by salva (Canon) on Feb 15, 2022 at 15:24 UTC | |
by kbro (Novice) on Feb 15, 2022 at 16:31 UTC | |
by hv (Prior) on Feb 16, 2022 at 23:07 UTC |