Objective
This article provides information on how to reset the CloudPlatform Administrator password.
If the password for the administrator account has been lost and cannot be reset using the user interface (there is no other administrator-level account to use), you can change it using API calls, or as a last resort by directly updating the database.
Instructions
Option 1 - API
Complete the following procedure to reset the password using API calls:
Note: This procedure uses unauthenticated API interface and typically must be performed on the CloudPlatform server and the most preferred method.
Retrieve the ID of the user.
In CloudStack 2.2.x the default administrator account is ID 2. In CloudPlatform 3.0 the ID is a GUID.
curl 'http://localhost:8096/api?command=listUsers&username=admin' 2>/dev/null | xmllint --format - -o -
Using the ID from step 1, set a new password to the default of "password" for account ID 2 using the following command:
curl 'http://localhost:8096/api?command=updateUser&id=2&password=5f4dcc3b5aa765d61d8327deb882cf99' 2>/dev/null | xmllint --format - -o -
Option 2 - Database
Complete the following procedure to reset the password directly in the CloudPlatform database:
Note: This procedure must be done on a server having MySQL client installed and access to CloudPlatform database.
Backup the database.
For example, you can use the following command:
mysqldump -u root -ptherootpassword cloud > cloud_backup.sql
Go to the MySQL Command Line Interface:
mysql -u root -ptherootpassword cloud
If required, run a query to view the existing configuration for the administrator account:
SELECT id,username,password FROM user WHERE username = 'admin';
To change the password, set the "password" field to the MD5 hash of the new password. The following command sets it to the default of "password":
UPDATE user SET password = '5f4dcc3b5aa765d61d8327deb882cf99' WHERE username = 'admin';
Disclaimer
The above mentioned sample code is provided to you as is with no representations, warranties or conditions of any kind. You may use, modify and distribute it at your own risk. CITRIX DISCLAIMS ALL WARRANTIES WHATSOEVER, EXPRESS, IMPLIED, WRITTEN, ORAL OR STATUTORY, INCLUDING WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NONINFRINGEMENT. Without limiting the generality of the foregoing, you acknowledge and agree that (a) the sample code may exhibit errors, design flaws or other problems, possibly resulting in loss of data or damage to property; (b) it may not be possible to make the sample code fully functional; and (c) Citrix may, without notice or liability to you, cease to make available the current version and/or any future versions of the sample code. In no event should the code be used to support of ultra-hazardous activities, including but not limited to life support or blasting activities. NEITHER CITRIX NOR ITS AFFILIATES OR AGENTS WILL BE LIABLE, UNDER BREACH OF CONTRACT OR ANY OTHER THEORY OF LIABILITY, FOR ANY DAMAGES WHATSOEVER ARISING FROM USE OF THE SAMPLE CODE, INCLUDING WITHOUT LIMITATION DIRECT, SPECIAL, INCIDENTAL, PUNITIVE, CONSEQUENTIAL OR OTHER DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Although the copyright in the code belongs to Citrix, any distribution of the code should include only your own standard copyright attribution, and not that of Citrix. You agree to indemnify and defend Citrix against any and all claims arising from your use, modification or distribution of the code.
Applicable Products
CloudPlatform 4.2.x
print
Was this helpful? Yes No
|