Skip to main content
bandarusridhar1
Gold ⭐️
October 16, 2016

How to change /apps/hive/warehouse directory permission which shows 777 by default.

  • October 5, 2026 at 9:35 AM
  • 1 reply
  • 3288 views
  • Translate All

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

  1. Search for hive_apps_whs_dir which 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
)

  1. Modify the value for mode from 0755 to the desired permission, for example, 0777.
  2. Save and close the file.
  3. Restart the Ambari server to propagate the change to all nodes in the cluster:

    ambari-server restart

    It 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

  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.

Hope this helps you.

1 reply

schitirala
Silver ⭐️⭐️⭐️
October 18, 2016

@SBandaru To my knowledge, it's not advisable to change the pre-defined ambari scripts. These changes might affect the the potential upgrade of ambari server in future. A best practice would be developing an individual maintenance script to change the permissions of the hive warehouse.

Translate