Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How to get Unix group Name mapped to Sentry role

Highlighted

How to get Unix group Name mapped to Sentry role

Explorer

Hello Team,

 

I have a query mentioned below.

 

1. How to find Unix group Name mapped to Sentry role? 100 Unix group exist on cluster Node and 10-20 sentry roles created. Require command to find which Unix group mapped to Which Unix group.

 

2. below command through beeline gives role name by providing Unix group. I want reverse way, supply role name and get unix group name.

SHOW ROLE GRANT GROUP abcde;

 

- Vijay M 

3 REPLIES 3

Re: How to get Unix group Name mapped to Sentry role

Cloudera Employee
Hi @VijayM

To list all the roles assigned to the given group name (only allowed for Sentry admin users and other users that are part of the group specified by group name) you can use the below command from beeline.

SHOW ROLE GRANT GROUP group name;

Also for more details about beeline commands, you can refer to

https://www.cloudera.com/documentation/enterprise/latest/topics/sg_hive_sql.html

Regards,
Tarun Jangid

Re: How to get Unix group Name mapped to Sentry role

Explorer

@tjangid 

 

Thank you for the reply. 

 

I am looking for Sentry command from beeline which gives me group name through roles.

 

Like show  groups which mapped to given role.

 

The command you have suggested i am already aware of but for example if hosts have more than 50-60 Unix groups so 50-60 times i have to run your suggested command to find the role name.

 

- Vijay M

Re: How to get Unix group Name mapped to Sentry role

Cloudera Employee
Hi @VijayM

I am afraid that you cannot gather the required information from the Sentry command. However, you can get it from the MySQL database.

To do so, please follow:
1. Login to MySQL.
2. Select the Sentry database using "use <database>".
3. Execute the below query:

SELECT DB_NAME, ACTION,ROLE_NAME,GROUP_NAME FROM SENTRY_DB_PRIVILEGE
INNER JOIN SENTRY_ROLE_DB_PRIVILEGE_MAP ON SENTRY_DB_PRIVILEGE.DB_PRIVILEGE_ID=SENTRY_ROLE_DB_PRIVILEGE_MAP.DB_PRIVILEGE_ID
INNER JOIN SENTRY_ROLE ON SENTRY_ROLE.ROLE_ID=SENTRY_ROLE_DB_PRIVILEGE_MAP.ROLE_ID
INNER JOIN SENTRY_ROLE_GROUP_MAP ON SENTRY_ROLE_GROUP_MAP.ROLE_ID=SENTRY_ROLE.ROLE_ID
INNER JOIN SENTRY_GROUP ON SENTRY_GROUP.GROUP_ID=SENTRY_ROLE_GROUP_MAP.GROUP_ID;

Please do let me know if this helps you.

Regards,
Tarun Jangid
Don't have an account?
Coming from Hortonworks? Activate your account here