libssh2_knownhost_readfile(3)
π libssh2_knownhost_readfile β bestie, it's time to read your known_hosts file
okay so picture this: you're in the libssh2 manual (yes we're in section 3, the library-call section, iykyk) and you found libssh2_knownhost_readfile(3). it's giving "load up all my lil known hosts from a file." let's get into it π¦
β¨ SYNOPSIS β¨
#include <libssh2.h>
int
libssh2_knownhost_readfile(LIBSSH2_KNOWNHOSTS *hosts,
const char *filename, int type);
πΈ DESCRIPTION πΈ
so basically this function reads a whole collection of known hosts out of a file you point it at, and then adds them to the collection of known hosts you already have. it's literally just scooping them in. no drama, no cap. π
filenameβ this is the one that specifies which file to read. that's it. that's the whole job. point at the file, bestie π«Άtypeβ this tells it what file type it is. and rn,LIBSSH2_KNOWNHOST_FILE_OPENSSHis the only currently supported format. this file is normally found hanging out named~/.ssh/known_hostsβ yeah, that one. the iconic one. π
β RETURN VALUE β
here's the vibe check on what you get back:
- a negative value β that's your regular
libssh2error code, so something went wrong π - a positive number β that's the number of parsed known hosts in the file, and that's a slay β¨
π AVAILABILITY π
added in libssh2 1.2 β so she's been around a minute, a real veteran π
π SEE ALSO π
go read these next, fr fr:
and that's the whole page, bestie π§ this lil slice of the libssh2 manual (yes, manual name is literally libssh2) was dated 28 May 2009 and shipped under the source/version tag libssh2 β so go forth, read those hosts, and stay iconic ππΈπ
π¦ 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