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

Description

This function checks the SSH credentials on the remote server.

Authentication

There are several methods that you can use to authenticate a transfer session with the remote server.

PermitRootLogin=Yes

The simplest authentication method is to use the root user and password. To do this, the sshd_config file on the remote server must contain the following value: PermitRootLogin=Yes

The following table displays the correct parameters and values for this authentication method:

Parameter
Value
userroot
passwordroot's password

You can also use the SSH Public Key to authenticate the root user. If the SSH Public Key is encrypted, include the SSH Key's passphrase.

The following table displays the correct parameters and values for this authentication method:

Parameter
Value if SSH Key is not encrypted
Value if SSH Key is encrypted
userrootroot
sshkeyroot's SSH keyroot's SSH key
sshkey_passphrase(none)root's SSH key passphrase

PermitRootLogin=No

Many server administrators do not permit direct root logins on their servers.

  • If the remote server contains PermitRootLogin=No in the sshd_config file, then you must use another user and their password on the remote server, and then escalate to root.
  • If the system administrator used WHM's Manage Wheel Group Users interface (Home >> Security Center >> Manage Wheel Group Users) to grant the user su access, you will need to specify su and the root password.
  • If the user has sudo access, you do not need the root password.

The following table displays the correct parameters and values for this authentication method:

Parameter
Value if the user has sudo access
Value if the user has su access
userusernameusername
passworduser's passworduser's password
root_escalation_methodsudosu
root_password(none)root's password

You can also use an SSH Public Key instead of a password to authenticate that user. If the SSH Public Key is encrypted, include the SSH Key's passphrase.

The following table displays the correct parameters and values for this authentication method:

Parametersudosu
userusernameusername
sshkeyuser's SSH keyuser's SSH key

sshkey_passphrase (If encrypted)

user's SSH key passphraseuser's SSH key passphrase
root_escalation_methodsudosu
root_password(none)root's password

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/remote_basic_credential_check?api.version=1&host=remote.example.com&port=22&user=root&password=luggage12345&sshkey=testsshkey&sshkey_passphrase=kkwtoowoygidsa
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/remote_basic_credential_check?api.version=1&host=remote.example.com&port=22&user=root&password=12345luggage&sshkey=testsshkey&sshkey_passphrase=kkwtoowoygidsa
 Command Line
whmapi1 remote_basic_credential_check host=remote.example.com port=22 user=root password=12345luggage sshkey=testsshkey sshkey_passphrase=kkwtoowoygidsa


Notes:

  • 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": {
    "response": "basic credential check\n",
    "output": "Basic credential check\u2026\nDone\n"
  },
  "metadata": {
    "version": 1,
    "reason": "Success",
    "result": "1",
    "command": "remote_basic_credential_check"
  }
}
 Output (XML)
<result>
    <data>
        <response>basic credential check</response>
        <output>Basic credential check&#x2026;Done</output>
</data>
<metadata>
    <version>1</version>
    <reason>Success</reason>
    <result>1</result>
    <command>remote_basic_credential_check</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 or IP address.

A valid hostname or IP address.remote.example.com
portinteger

Required

The remote server's SSH port number.

A positive integer.22
userstring

Required

The username to use to connect to the remote server.

A valid username.root
passwordstringThe username's password.A secure password.12345luggage
root_escalation_methodstring

The escalation method to use to connect to the remote server.

Note:

Use this parameter if PermitRootLogin=No in the remote server's sshd_config file.

  • su
  • sudo
sudo
root_passwordstring

root's password on the remote server.

Note:

Use this parameter if PermitRootLogin= No in the remote server's sshd_config file and the root_escalation_method value is set to su.

A secure password.12345luggage
ssh_keystring

The SSH key's name.

Note:

SSH keys are available in WHM's Manage root's SSH Keys interface (Home >> Security Center >> Manage root’s SSH Keys).

A valid string.FrancisScott
sshkey_passphrasestring

The SSH key's passphrase.

Note:

 Use this parameter if the SSH Key is encrypted.

A secure passphrase.kkwtoowoygidsa

Returns

ReturnTypeDescriptionPossible valuesExample

response

stringThe function call's response.A valid string.
basic credential check

output

stringThe function call's raw HTML output.A valid string.Basic credential check&#x2026;Done