You can find our user documentation at docs.cpanel.net.

Check out our new API beta site!

Child pages
  • WHM API 1 Functions - check_remote_ssh_connection
Skip to end of metadata
Go to start of metadata

Description


This function tests an SSH connection to another server.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/check_remote_ssh_connection?api.version=1&host=example.com&port=22
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/check_remote_ssh_connection?api.version=1&host=example.com&port=22
 Command Line
whmapi1 check_remote_ssh_connection host=example.com port=22


Notes:

  • Unless otherwise noted, you must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{
  "data": {
    "server_software": "OpenSSH_5.3",
    "comment": null,
    "received": "SSH-2.0-OpenSSH_5.3",
    "protocol_versions": [
      "2.0"
    ]
  },
  "metadata": {
    "version": 1,
    "reason": "OK",
    "result": "1",
    "command": "check_remote_ssh_connection"
  }
}
 Output (XML)
<result>
    <data>
        <server_software>OpenSSH_5.3</server_software>
        <comment/>
        <received>SSH-2.0-OpenSSH_5.3
        </received>
        <protocol_versions>2.0</protocol_versions>
    </data>
<metadata>
    <version>1</version>
    <reason>OK</reason>
    <result>1</result>
    <command>check_remote_ssh_connection</command>
</metadata>
</result>


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
hoststring

Required

The remote server's hostname.

A valid hostname.

example.com
portinteger

The remote server's port number.

This parameter defaults to 22.

A valid positive integer.22

Returns

ReturnTypeDescriptionPossible valuesExample
protocol_versionsarray

The available SSH protocol versions.

  • A valid string.
  • undef — If the local and remote servers connect successfully.
2.0 

server_software

string

The version of the remote server's SSH server software.

  • A valid string.
  • undef — If the local and remote servers connect successfully.
OpenSSH_5.3
commentstringThe remote connection's comment section.
  • A valid string.
  • undef — If the local and remote servers connect successfully.
null
receivedstringThe raw data from the remote server.

A valid string.

SSH-2.0-OpenSSH_5.3