How to change /apps/hive/warehouse directory permission which shows 777 by default.
If you are not using any Hive Authorization like SQL Standard Authorization or Ranger and you don't want other to read/write data and allow the only owner to read & write, and allowing the group to read.
Changing the warehouse directory permission.
1.From the command line in the Ambari server node, edit the file
/var/lib/ambari-server/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
- Search for
hive_apps_whs_dirwhich should go to this block:
params.HdfsResource(params.hive_apps_whs_dir,
type="directory",
action="create_on_execute",
owner=params.hive_user,
group=params.user_group,
mode=0755
)
- Modify the value for mode from 0755 to the desired permission, for example, 0777.
- Save and close the file.
- Restart the Ambari server to propagate the change to all nodes in the cluster:
ambari-server restartIt may take a few seconds to update the file in the Ambari agents on all nodes. To verify if the change has been applied on a particular node, check the content of hive.py in
/var/lib/ambari-server/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py - 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.
Hope this helps you.

