How to make a user an admin in Hue

If you followed my previous post on how to configure Hue to use PAM for authentication, I mentioned that if you have previously logged into Hue before making this change then you will no longer be able to login with the admin account you originally created.

There is an easy way around this if you are using the default database. First you'll need to SSH to the server where Hue is installed, then start the Hue shell.

sudo /usr/share/hue/build/env/bin/hue shell

Then run the following Python code to make a user the administrator:

from django.contrib.auth.models import User
a = User.objects.get(username='<username>')
a.is_staff = True
a.is_superuser = True
a.save()

Obviously replacing <username> with the actual user. I found this solution in the Cloudera community forums.

Comments