Set up Access to HUE Using Linux Credentials - Teaching Big Data Skills with Amazon EMR

Set up Access to HUE Using Linux Credentials

HUE is an open source user interface for Hadoop that makes it easier to run and develop Hive queries, manage files in HDFS, run and develop Apache Pig scripts, and manage tables.

HUE looks for an exact match of the HUE username to the HDFS user and associated permissions to allow file operations. HUE users can be created manually using the HUE user interface, or can be scripted using Python.


Superuser must be created by first login to HUE console.

The following commands can be used to script the HUE user creation process using Python:

  1. Open the HUE shell by running the following command on the Linux prompt

    sudo /usr/lib/hue/build/env/bin/hue shell
  2. Import django libraries for USER and GROUP

    from django.contrib.auth.models import User from django.contrib.auth.models import Group
  3. Create HUE user and store the user in an object.

    objUser = User.objects.create_user (username='INSERT_USER_NAME', password='INSERT_USER_PASSWORD', first_name='INSERT_FIRST_NAME', last_name='INSERT_LAST_NAME')
  4. Get HUE group in an object – this example uses students as the group name.

    objGroup = Group.objects.get (name='students')
  5. Attach the newly created HUE user to HUE group.

    objGroup.user_set.add (objUser)
  6. Apply the settings.
  7. Quit the HUE shell.