hive 数据安全

来源:互联网 发布:veket linux.iso 编辑:程序博客网 时间:2024/06/05 08:32

hive 数据安全


角色管理

--创建和删除角色 

create role role_name; 

drop role role_name; 

--展示所有roles 

show roles 

--赋予角色权限 

grant select on database db_name to role role_name;   

grant select on [table] t_name to role role_name;   

--查看角色权限 

show grant role role_name on database db_name;  

show grant role role_name on [table] t_name;  

--角色赋予用户 

grant role role_name to user user_name 

--回收角色权限 

revoke select on database db_name from role role_name; 

revoke select on [table] t_name from role role_name; 

--查看某个用户所有角色 

show role grant user user_name;

权限说明

 移除点击此处添加图片说明文字

查看用户权限:

show grant user hive;

分配权限

基于角色:

GRANT CREATE ON DATABASE 

default

TO group test_role; 

GRANT SELECT on table authorization_test to group test_role; 

GRANT DROP on table authorization_test to group test_role; 

GRANT ALL on table authorization_test to group test_role;

基于用户:

GRANT CREATE ON DATABASE 

default

TO user mllib; 

GRANT SELECT on table authorization_test to user mllib; 

GRANT DROP on table authorization_test to user mllib; 

GRANT ALL on table authorization_test to user mllib;

分配创建数据库的权限

GRANT CREATE  TO user root;

5、查看权限分配

SHOW GRANT user mllib ON DATABASE 

default

;    

SHOW GRANT group test_role ON DATABASE 

default

;

6、删除权限

revoke all on database spark from user mllib;


原创粉丝点击