how to get example ssh2_agent.c to work?

Barry Scott barry at
Wed Nov 30 16:43:22 CET 2022

I am developing on fedora 37.

    $ rpm -q libssh2 libssh2-devel

I have this in libssh2_config.h

    /* Headers */
    #define HAVE_UNISTD_H
    #define HAVE_INTTYPES_H
    #define HAVE_STDLIB_H
    // #define HAVE_SYS_SELECT_H
    #define HAVE_SYS_SOCKET_H
    // #define HAVE_SYS_TIME_H
    #define HAVE_ARPA_INET_H
    #define HAVE_NETINET_IN_H

Compile example like this:

    $ gcc ssh2_agent.c -lssh2 -o example_ssh2_agent

Run like this:

    $ ./example_ssh2_agent barry
    Fingerprint: 15 33 80 FF 56 A6 0D 49 4B 36 09 58 F1 F1 77 3C F7 6D A8 F3
    Authentication methods: publickey,gssapi-keyex,gssapi-with-mic,password
            Authentication with username barry and public key /Users/barry/.ssh/id_rsa failed!
    Couldn't continue authentication
    all done!

But get authentication failed error however ssh is happy to work:

    $ ssh barry at
    Last login: Wed Nov 30 14:52:12 2022 from
    Login via bash profile - terminal xterm-256color


What do I need to do to make this work?


More information about the libssh2-devel mailing list