Community Articles
Find and share helpful community-sourced technical articles
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.
Labels (1)
New Contributor

For security reasons, sometimes we might need to deactivate the ambari users ,rather deleting.In these scenerios make the user inactive from ambari UI, however if the users are more we might need to automate it from rest API as mentioned below.

The objective is to deactivate the user "ritesh" . One of method is from UI

Go to Admin --> manage users --> users --> click on user name


We can see the user is in ACTIVE State. You can use this toggle button to change the value.


Deactivate a user from REST API.

1. If you try to curl the rest API link, it will show you all the users in the ambari. To get the properties for a particular user, append the user name at the end of the API (like below)


If we analyze above output, we see an element "active"="true" which controls the status of that user (active/inactive)

Hence to disable the user, run this below command. Please notice that the command has argument ("Users/active":"false") for PUT method and has been extracted from above output. You can change this body to change other values like admin.


curl -iv -u username:password -H "X-Requested-By: ambari" -X PUT -d '{"Users/active":"new_value"}' http://ambariserver:8080/api/v1/users/user_name

For example:

curl -iv -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"Users/active":"false"}'

Once this command is executed we can see the new updated value in CLI and UI.



0 Kudos
Don't have an account?
Coming from Hortonworks? Activate your account here
Version history
Revision #:
2 of 2
Last update:
‎08-17-2019 07:45 AM
Updated by:
Top Kudoed Authors