Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

How to change the default username for Ambari UI which is admin?

avatar

Hello,

I need to change the default username for Ambari UI which is "admin" through Ambari API.

I found the service to change the default password for the default username (admin/admin) :

curl -i -u $AMBARI_ADMIN_USERID:$AMBARI_ADMIN_PASSWORD -H "X-Requested-By: ambari" -X PUT -d '{"Users": { "user_name": "$USER_NAME", "password": "$USER_NEW_PWD", "old_password": "$USER_OLD_PWD"}}' http://$AMBARI_SERVER:8080/api/v1/users/$USER_NAME

So,could anyone help me to find this service?

1 ACCEPTED SOLUTION

avatar
Master Mentor
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login
5 REPLIES 5

avatar
Master Mentor
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login

avatar

@Jay SenSharma

Thank you for your reply.

My question is how to change the username for Ambari UI which is by default "admin".

I explained that i only found the service to change the default password for admin user and that I'm looking for similar service but this time is to change the default username.

avatar
Master Mentor

@raouia

You can not change the username using Ambari APIs.

The user information is stored inside the ambari Database. This is how you can login to ambari DB

[root@amb25101 ~]# psql -U ambari ambari
Password for user ambari:  bigdata
psql (9.2.18)
Type "help" for help.

ambari=> select user_id, user_name, user_password from users;
 user_id | user_name |                                  user_password                                   
---------+-----------+----------------------------------------------------------------------------------
       1 | admin     | b3ca8cd26130ff701e1fd9ee18f310b2efdf27876b1fb8330367a055cb5852a3c26885a71affdd63
(6 rows)

.

avatar
Master Mentor

@raouia

So you can change the default ambari admin username "admin" directly inside the Ambari Database using the following query.

UPDATE users SET user_name = 'ambariadmin' WHERE user_name='admin';

.

Any changes we make in the ambari Database requires a ambari server restart.

avatar

@Jay SenSharma

Thank you for your pertinent explanation. Now, i found a way to change the default username through the DB.