Provide User Access to Hive Database Tables from the Command Line
Hive provides the means to manage user access to Hive database tables directly from the command line. The most commonly-used commands are:
GRANT
Syntax:
grant
<permissions>on table
<table>to user
<user or group>;
For example, to create a policy that grants user1 SELECT permission on the table default-hivesmoke22074, the command is
grant select on table default.hivesmoke22074 to user user1;
The syntax is the same for granting UPDATE, CREATE, DROP, ALTER, INDEX, LOCK, ALL and ADMIN rights.
REVOKE
Syntax:
revoke
<permissions>on table
<table>from user
<user or group>;
For example, to revoke the SELECT rights of user1 to the table default.hivesmoke22074, the command is
revoke select on table default.hivesmoke22074 from user user1;
The syntax is the same for revoking UPDATE, CREATE, DROP, ALTER, INDEX, LOCK, ALL and ADMIN rights.