Apache Ranger User ManagementPDF version

Deleting users or groups in bulk

How to delete users or groups in bulk in Ranger.

You can delete users and groups from Ranger by using the deleteUserGroupUtil.py script in /opt/cloudera/parcels/CDP/lib/ranger-admin/deleteUserGroupUtil.py.
Only users with the "admin" role can delete users or groups in bulk.
  1. Get all the users through API or from database directly:
    # GET http://<ip>:6080/service/xusers/users/
    # GET http://<ip>:6080/service/xusers/groups/
    Or
    # select user_name from x_user
  2. Save all the users you want to delete in a file, except service users (keep only AD/LDAP users).
  3. On the Ranger host, go to the following location:
    cd /opt/cloudera/parcels/CDP-<version>/lib/ranger-admin/
  4. Run the following Python script:
    Example - # python /opt/cloudera/parcels/CDH/lib/ranger-admin/deleteUserGroupUtil.py -users <user file path> 
    -admin <ranger admin user> -force -url <Ranger Admin URL> -sslCertPath: <Filepath to ssl certificate to use when Ranger Admin uses HTTPS>
  5. Verify on Ranger UI.