Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^5: get ssh key passphrase from agent

by ninto1 (Novice)
on Aug 31, 2022 at 07:32 UTC ( [id://11146542]=note: print w/replies, xml ) Need Help??


in reply to Re^4: get ssh key passphrase from agent
in thread get ssh key passphrase from agent

Thank you for helping. Sure:

#!/usr/bin/perl -w use Net::SSH2; my $ssh2 = Net::SSH2->new(); $ssh2->connect('158.226.63.99') or $ssh2->die_with_error; $ssh2->auth_agent('z004kapc') or $ssh2->die_with_error; my $chan = $ssh2->channel() or $ssh2->die_with_error; $chan->exec('pwd') or $ssh2->die_with_error; print while <$chan>;

Replies are listed 'Best First'.
Re^6: get ssh key passphrase from agent
by Corion (Patriarch) on Aug 31, 2022 at 07:54 UTC

    And line 7 is the line where you try to talk to the agent. I presume that the environment variables are set up so that the domain socket etc. are found?

    Does the error message change when you set the environment variables ($ENV{SSH_AUTH_SOCKET} ?) to some invalid value before creating $ssh2?

    Does your Perl process run as the same user as the ssh process you're using to connect?

    Maybe consider setting trace => -1 in the constructor to dump lots (and lots) of information, and maybe compare that to what the ssh -vvv executable does. Maybe there is a difference that shows up?

    my $ssh2 = Net::SSH2->new(trace => -1);

      This is very helpful, since I don't have this env. Variable for some reason.

      I think a cause for this could be that I use Windows, since I need to develop it for windows.

      Do you know, how I could make it compatible nevertheless?

      Edit: I noticed that it may come across sarcastic, but it is actually helpful, because it made me find out I don't have it

        This is weird - are you per chance using the ssh-agent and ssh that comes with Windows or are you using the OpenSSH binaries?

        Mixing the two doesn't work and my attempts to mix the two always ended in tears...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11146542]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-25 15:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found