Open-Source | WSO2 | Carbon

Changing password in WSO2 Carbon products

Defining and changing the login password for user accounts in WSO2 products.

Kosala Sananthana
3 min readMar 6, 2019

When you using a WSO2 Carbon Product (API Manager, Identity Server, Enterprise Integrator or Stream Processor) rather than a testing session in your local machine you should change the default passwords. In default, for ‘Super Tent’ admin account has the following credentials.

Username: admin
Password: admin

You should need to the above credentials to add and modify the tents, users, and roles used in WSO2 Carbon products. In this article, we will talk about three different methods to modify the ‘Super Tent’ admin account login password.

  1. At the first startup (Define a new password)
  2. Change password using the previous password (Change the password)
  3. Change password without the previous password (Reset the Password)

📝 At the first startup

In this method, you only can define the admin login password before the first startup of the WSO2 product server. Therefore, you should modify admin password at the very begging of the server start.

In all WSO2 carbon products, user data stored database has been defined on user-mgt.xml file which is located at

<PRODUCT_HOME>/repository/conf/user-mgt.xml

You can change the admin login password parameter in the user-mgt.xml file as shown in the following image. Then start the product and login to the carbon console with new credentials.

Change the <Password> parameter to modify the password (Shown with the white arrow)

After the first startup, all the credentials will store in the user database and you would not able to change it from the above file. So you can only change it (where the change is actually effective) before you start the WSO2 carbon product for the first time 😯.

🔐 Change password using the previous password

After the first startup the WSO2 product, you would not be able to change the admin password by the above method. However, we can easily change the admin login password by login to carbon console that is available through the browser 😀. You should have the previous admin credentials to login carbon console first.

  1. Go to carbon management console using your favorite browser. ( default path is https://localhost:9943/carbon).
  2. Login with the admin credentials (default is admin/admin).
  3. On the Main tab, click List under Users and Roles.
  4. To change the admin password, click Change My Password, enter your current admin password and new admin password, and click Change.
Follow the steps given in numbers (Carbon Mangement Console)

📌 Change password without the previous password

What would happen, if you have forgotten the admin password (and therefore cannot access the Management Console) or you do not have the credentials with you 😓. Do not worry, not everything is lost yet and still, you can change the admin password with this method 😇.

  1. If you have not installed “ant” in your server, install it by running following command. ( Apache Ant is a prerequisite for this method)
Linux:
sudo apt-get install ant
macOS:
brew install ant

2. Copy related JDBC driver (which match with the database management system you have used) to the following location.

<PRODUCT_HOME>/lib/

If you are using MySQL database, you can download MySQL database drivers from here.

3. Go to the following location.

cd <PRODUCT_HOME>/bin/

4. Run the following command to reset the password for your admin account.

bash chpasswd.sh --db-driver "<DB_DRIVER_CLASS>" --db-url "<DB_URL>" --db-username "<DB_USERNAME>" --db-password "<DB_PASSWORD>" --username "admin" --new-password "<NEW_PASSWORD>"

The following message is displayed if the password is updated successfully 😜.

Password of user [username] updated successfully

5. Login to the carbon management console with new admin credentials.

--

--

Kosala Sananthana

PhD Student @ AχL — Monash University | Former Senior Software Engineer @ WSO2 Inc. | Writer @ The Startup/Better Programming/Towards Data Science