how to get example ssh2_agent.c to work?

Barry Scott barry at barrys-emacs.org
Wed Nov 30 16:43:22 CET 2022


I am developing on fedora 37.

    $ rpm -q libssh2 libssh2-devel
    libssh2-1.10.0-5.fc37.x86_64
    libssh2-devel-1.10.0-5.fc37.x86_64

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 127.0.0.1 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 127.0.0.1
    Last login: Wed Nov 30 14:52:12 2022 from 127.0.0.1
    Login via bash profile - terminal xterm-256color

    $

What do I need to do to make this work?

Barry



More information about the libssh2-devel mailing list