Child pages
  • WHM API 0 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?user=username&pass=12345luggage&enabledigest=1
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/passwd?user=username&pass=12345luggage&enabledigest=1
 Command Line
whmapi0 passwd user=username pass=12345luggage enabledigest=1


Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 0 documentation or run the whmapi0 --help command. 
  • We introduced this functionality in cPanel & WHM version 11.52.0.8.

 Output (JSON)
{  
   "passwd":[  
      {  
         "statusmsg":"Password changed for user "username".",
         "services":[  
            {  
               "app":"system"
            },
            {  
               "app":"ftp"
            },
            {  
               "app":"mail"
            },
            {  
               "app":"MySQL"
            },
            {  
               "app":"webdisk (digest)"
            }
         ],
         "rawout":"Password for "username" has been changed.\nUpdating FTP passwords for username\nFTP password files updated.\nFTP vhost passwords synced\n",
         "status":1
      }
   ]
}
 Output (XML)
<passwd>
    <passwd>
        <rawout>
            Password for &#x201C;username&#x201D; has been changed. Updating FTP passwords for username FTP password files updated. FTP vhost passwords synced
        </rawout>
        <services>
            <app>system</app>
        </services>
        <services>
            <app>ftp</app>
        </services>
        <services>
            <app>mail</app>
        </services>
        <services>
            <app>MySQL</app>
        </services>
        <services>
            <app>webdisk (digest)</app>
        </services>
        <status>1</status>
        <statusmsg>Password changed for user &#x201C;username&#x201D;.</statusmsg>
    </passwd>
</passwd>

Parameters

ParameterTypeDescriptionPossible valuesExample
userstring

Required

The account's username.

A cPanel account username on the server.

username
passstring

Required

The account's new password.

A secure password.

12345luggage
enabledigestBoolean

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 pass value.
  • 0 — Do not update.
0

 

Returns

ReturnTypeDescriptionPossible valuesExample

status

Boolean

Whether the system successfully called the function.

  • 1 — Success.
  • 0 — Failure.

 

1

statusmsg

string

A message of success or a reason for failure.

  • A success message.
  • An error message.

Password changed for user “username”.

rawoutstringThe function's output messages.One or more output strings.
 Click to view...
Password for “username” has been changed.\nUpdating FTP passwords for username\nFTP password files updated.\nFTP vhost passwords synced\n
servicesarray of hashesAn array of hashes of services for which the system changed the password.Each hash includes the app return. 

app

string

A service for which the password changed.

The function returns this value in the services hash.

A valid service name.ftp