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

 

Description

This function modifies a cPanel or reseller account's password.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/passwd?api.version=1&user=username&password=12345luggage&enabledigest=1
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/passwd?api.version=1&user=username&password=12345luggage&enabledigest=1
 Command Line
whmapi1 passwd user=username password=12345luggage enabledigest=1


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":{  
      "app":[  
         "system",
         "ftp",
         "mail",
         "MySQL",
         "webdisk (digest)"
      ]
   },
   "metadata":{  
      "version":1,
      "reason":"Password changed for user "username".",
      "output":{  
         "raw":"Password for "username" has been changed.\nUpdating FTP passwords for username\nFTP password files updated.\nFTP vhost passwords synced\n"
      },
      "result":1,
      "command":"passwd"
   }
}
 Output (XML)
<result>
    <data>
        <app>system</app>
        <app>ftp</app>
        <app>mail</app>
        <app>MySQL</app>
        <app>webdisk (digest)</app>
    </data>
    <metadata>
        <version>1</version>
        <reason>Password changed for user &#x201C;username&#x201D;.</reason>
        <output>
            <raw>
                Password for &#x201C;username&#x201D; has been changed. Updating FTP passwords for username FTP password files updated. FTP vhost passwords synced
            </raw>
        </output>
        <result>1</result>
        <command>passwd</command>
    </metadata>
</result>


Note:

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

   

Parameters

ParameterTypeDescriptionPossible valuesExample
userstring

Required

The account's username.

The username of a cPanel account on the server.

username
passwordstring

Required

The account's new password.

A secure password.

12345luggage

enabledigest

or

digestauth

Boolean

Whether to enable Digest Authentication for the account.

If you do not specify a value, the account retains its current Digest Authentication setting.

  • 1 — Enable.
  • 0 — Disable.
1
db_pass_updateBoolean

Whether to also change the account's MySQL® password.

This parameter defaults to 0.

  • 1 — Also update the account's MySQL password to match the password value.
  • 0 — Do not update.
0

 

Returns

ReturnTypeDescriptionPossible valuesExample
apparrayThe services for which the system changed the password.An array that contains the name of a service for which the function changed the account's password.ftp