in reply to Issue with Net::SSH::Perl - can't establish connection

You have two variables $USER and $USERNAME that probably should be just one. Use strict!

Replies are listed 'Best First'.
Re^2: Issue with Net::SSH::Perl - can't establish connection
by dayton (Acolyte) on Jul 20, 2017 at 15:33 UTC
    There's a reason I have $USER and $USERNAME, but I see your point and I'll look at combining them. But that doesn't explain why the script is failing... It's reading my .ssh/config, pulling the correct key/user combo and sends them to the remote server. The remote server accepts the key, but then the script dies with the error...
      Error reading response length from auth socket. at /usr/local/lib64/perl5/Net/SSH/Perl/Auth/PublicKey.pm line 104.

      That looks like the module is connecting to the local ssh agent and getting an unexpected response. Are your keys protected by a passphrase?

      I would run both the Perl script and the OpenSSH client with strace and see what both were doing different at the point of failure.

        Strange...yep, it's the connection to the local agent. I killed the existing agent (started when I logged in) and started a new one, and added the key. Connection successful! Now just need to figure out why the existing agent borked with Net::SSH::Perl but not with straight openssh... Thanks.