I am using libssh2
library to ssh connections in my mobile application. Here I want to use Agent Forwarding
support.
I have followed same procedure as they have provided in example here LibSSH2 Agent Forwarding.
I am able to create agent successfully but when I try to connect it with libssh2_agent_connect(agent)
It gives me error -39 LIBSSH2_ERROR_BAD_USE
.
Well I am checking same thing using MAC OSX terminal and it's working fine. Please suggest if anything wrong,
What I am doing is:
- I have Machine A, MAchine B, Machine C.
- I am creating RSA Key on default location in Machine A, I am adding that key to agent on Machine A, I can show added identity too with agent.
- Copying public key (which created in machine A and added in agent) in Machine B and Machine C. Now I can ssh with Machine B and Machine C without enter pass phrase of that key.
That means agent forwarding is working fine correct? Please suggest me if anything wrong in above flow. I am very new to ssh sorry if this is obvious.
I am doing same thing with libssh2, making connection with Machine B with same key which copied in machine B. Please suggest am I missing anything using libssh2 lib to forward agent?
Thanks!