Change default permission of hive database

  • 0

Change default permission of hive database

Category : Hive

When you create a database or internal tables in hive cli then by default it creates with 777 permission.Even though if you have umask in hdfs then also it will be same permission. But now you can change it with the help of following steps.

1.From the command line in the Ambari server node, edit the file

vi /var/lib/ambariserver/resources/commonservices/HIVE/

Search for hive_apps_whs_dir which should go to this block:








2. Modify the value for mode from 0777 to the desired permission, for example 0750.Save and close the file.

3. Restart the Ambari server to propagate the change to all nodes in the cluster:

ambariserver restart

4. From the Ambari UI, restart HiveServer2 to apply the new permission to the warehouse directory. If multiple HiveServer2 instances are configured, any one instance can be restarted.

hive> create database test2;


Time taken: 0.156 seconds

hive> dfs -ls /apps/hive/warehouse;

Found 9 items

drwxrwxrwx   – hdpuser hdfs          0 2016-09-08 01:54 /apps/hive/warehouse/test.db

drwxr-xr-x   -hdpuser hdfs          0 2016-09-08 02:04 /apps/hive/warehouse/test1.db

drwxr-x—   -hdpuser hdfs          0 2016-09-08 02:09 /apps/hive/warehouse/test2.db

I hope this will help you to serve your purpose.