CURL.SetOptionSSHKnownHosts
---------------------------

Sets the file path of the known\_host file to use.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [CURL](component_CURL.md) | [2.5](newinversion25.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "CURL.SetOptionSSHKnownHosts"; curl; Value { ; Encoding } ) 

**MBS**( **"CURL.SetOptionSSHKnownHosts";** /\* Sets the file path of the known\_host file to use. \*/  
**$curl**; /\* The CURL session handle. \*/   
**$Value**; /\* The known hosts file path.e.g. "/tmp/knownhosts.txt" \*/   
**$Encoding**) /\* Optional; The text encoding for text parameter.   
Default is UTF-8.e.g. "UTF8" \*/ 

### Parameters

| 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](https://www.monkeybreadsoftware.com/filemaker/faq.shtml). | "UTF8" | Optional |

### Result

Returns "OK" on success.

### Description

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](https://curl.haxx.se/libcurl/c/CURLOPT_SSH_KNOWNHOSTS.html) option in CURL manual.

### See also

- [CURL.SetOptionSSLVerifyHost](CURLSetOptionSSLVerifyHost.md)

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

  
[CURL.SetOptionSSHHostPublicKeySHA256](CURLSetOptionSSHHostPublicKeySHA256.md) - [CURL.SetOptionSSHPrivateKeyfile](CURLSetOptionSSHPrivateKeyfile.md)

[HTML Version](CURLSetOptionSSHKnownHosts.shtml)