libssh2_agent_userauth(3)
π libssh2_agent_userauth β bestie edition π
okay so this is a page from the libssh2 manual, and today we're learning how to let your little ssh-agent buddy do the whole "yes it's me, let me in" dance for you. no cap, it's lowkey the most satisfying part of the whole agent saga. π¦
β¨ NAME β¨
libssh2_agent_userauth β authenticate a session with a public key, with the help of ssh-agent
like, it logs you in. with a key. and ssh-agent does the heavy lifting. that's the vibe. π
πΈ SYNOPSIS πΈ
#include <libssh2.h>
int
libssh2_agent_userauth(LIBSSH2_AGENT *agent,
const char *username,
struct libssh2_agent_publickey *identity);
look at her. three args, one int back. she's giving effortless. β¨
π DESCRIPTION π
so here's who's who in this little friend group:
agentβ your ssh-agent handle, exactly the one thatlibssh2_agent_init(3)handed you. she's the main character of this operation. πusernameβ the remote user name you're trying to authenticate as. yes, the actual human (or service account) on the other end. not optional, bestie.identityβ the public key you want to authenticate with, as returned bylibssh2_agent_get_identity(3). this is the key that's about to get you through the door. π
and what does the function actually do? Attempt public key authentication with the help of ssh-agent. that's it, that's the whole thing. you bring the agent, the username, and the identity, and it goes and asks ssh-agent to do the signing magic on your behalf. you never touch the private key. she never leaves the house. iconic behaviour, fr fr. π
π₯ RETURN VALUE π₯
- returns
0if it succeeded β slay, you're in. π - or a negative value for error β π something went sideways, go check.
no in-between. zero or sad. that's the deal.
π AVAILABILITY π
added in libssh2 1.2. so if you're on anything older than thatβ¦ yeah, she's not there yet. sorry bestie. π«Ά
π¦ SEE ALSO π¦
read them in order and the whole flow will click, i promise. iykyk. β¨
real talk: this function is the payoff. init your agent, get your identity, then call her. that's the trilogy. π¬
mwah</purl> π that's a wrap on libssh2_agent_userauth(3), straight from the libssh2 manual, dated 23 Dec 2009 β yes she's an elder but she still ate. go authenticate something, bestie, you got this. π
β¨πΈ
π¦ where this page comes from
- alpine 3.22: libssh2-doc 1.11.1-r3 Β· BSD-3-Clause
- alpine 3.23: libssh2-doc 1.11.1-r4 Β· BSD-3-Clause
- alpine 3.24: libssh2-doc 1.11.1-r4 Β· BSD-3-Clause
- arch rolling: libssh2 1.11.1-7 Β· BSD-3-Clause
- debian trixie: libssh2-1-dev 1.11.1-1+deb13u1 Β· BSD3
- debian trixie: libssh2-1-dev 1.11.1-1+deb13u2 Β· BSD3
- epel 10: libssh2-docs 1.11.1-9.el10_3 Β· BSD-3-Clause
- epel 9: libssh2-docs 1.11.1-9.el9 Β· BSD-3-Clause
- fedora 43: libssh2-docs 1.11.1-4.fc43 Β· BSD-3-Clause
- fedora 43: libssh2-docs 1.11.1-9.fc43 Β· BSD-3-Clause
- fedora 44: libssh2-docs 1.11.1-5.fc44 Β· BSD-3-Clause
- fedora 44: libssh2-docs 1.11.1-9.fc44 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- ubuntu questing: libssh2-1-dev 1.11.1-1build1
- ubuntu questing: libssh2-1-dev 1.11.1-1ubuntu0.25.10.2
- ubuntu resolute: libssh2-1-dev 1.11.1-1build2 Β· BSD3
- ubuntu resolute: libssh2-1-dev 1.11.1-1ubuntu0.26.04.4 Β· BSD3
- ubuntu stonking: libssh2-1-dev 1.11.1-6 Β· BSD3
- π the page's license: BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms