Friday, June 17, 2016

How to change WSO2 carbon product password using SHELL script

Sometimes users may forget the admin user password and need to change the admin user password. For this kind of a use case we can use the shell script ("chpasswd.sh") which shipped with WSO2 Carbon products.

I will share the steps on changing password on BAM 2.5.0 which configure to use mysql database as the user management datasource.


1) Open a command prompt and go to the <WSO2_BAM>/bin folder on the machine that hosts the Carbon server.
2) You can find "chpasswd.sh" inside the bin folder
3) Then execute the chpasswd.sh with following command line options.
--db-url (The database URL)
--db-driver (The database driver class)
--db-username (The username for the database)
--db-password (The password for the database)
--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.)
Example -
./chpasswd.sh  --db-driver "com.mysql.jdbc.Driver" --db-url "jdbc:mysql://localhost:3306/BAMDB"  --db-username "root" --db-password "root" --username "admin" --new-password "admin1234"
Note - Please shut down the WSo2 BAM server before execute the shpasswd.sh and if you got error "Database driver not found in classpath" please add the DB driver to the <WSO2_BAM>/lib folder and execute the command.
If success, You will see following output.
Password updated successfully

No comments :

Post a Comment