Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old


Sets the file path of the known_host file to use.

Component Version macOS Windows Linux Server iOS SDK
CURL 2.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "CURL.SetOptionSSHKnownHosts"; curl; Value { ; Encoding } )   More


Parameter Description Example Flags
curl The CURL session handle. $curl
Value The known hosts file path. "/tmp/knownhosts.txt"
Encoding The text encoding for text parameter.
Default is UTF-8.
Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the FAQ.
"UTF8" Optional


Returns "OK" on success.


Sets the file path of the known_host file to use.
The known_hosts file should use the OpenSSH file format as supported by libssh2. If this file is specified, libcurl will only accept connections with hosts that are known and present in that file, with a matching public key.

See also SSH_KNOWNHOSTS option in CURL manual.

See also

Created 18th August 2014, last changed 5th July 2015

CURL.SetOptionSSHHostPublicKeySHA256 - CURL.SetOptionSSHPrivateKeyfile