Changing the password of WSO2 carbon products using shell script

Dilsi Chandrasena
2 min readOct 2, 2017

--

If you forgot the admin user password of the carbon products that you used you cannot access the Management Console.

In this type of cases, you can run a shell script to change the password. This script (chpassword.sh) is included within <PRODUCT_HOME>/bin directory.

Prerequisites

Should be installed Apache Ant on your machine.

Steps to change the password of Carbon Products.

  1. Open the command prompt and navigate to the <PRODUCT_HOME>/bin directory.
  2. Run the given command inside the “bin”. (sh chpasswd.sh or ./chpassword.sh)
  3. If it is successfully built, you can find below options as the follows.

— db-url : The database URL
— db-driver : The database driver class. e.g. org.h2.Driver
— db-username : The database username
— db-password : The database password
— username : The username of the user whose password is to be changed. If this is not given, you will be prompted for this field later.
— new-password : The new password of the user whose password is to be changed. If this is not given, you will be prompted for this field later.

4. Following is an example to change admin password of userstore database, when using MySQL.

sh chpasswd.sh — db-driver “com.mysql.jdbc.Driver” — db-url “jdbc:mysql://localhost:3306/userstore” — db-username “root” — db-password “root” — username “admin” — new-password “admin123”

5. If it is successfully changed, you can get the output as below.

Password updated successfully.

6. But, if you got the output as the below, please add the Database Driver to <PRODUCT_HOME>/lib directory and restart the server.

Database driver [com.mysql.jdbc.Driver] not found in classpath.

7. Then you can update the password successfully and login to the Management Console with the new password.

--

--

Dilsi Chandrasena
Dilsi Chandrasena

Responses (3)