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:-

#!/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 }
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!

In reply to Net::OpenSSH channel_post_mux_listener getpeereid failed: Operation not supported [RESOLVED] by kbro

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.