The Hue service in E-MapReduce (EMR) allows you to create Hue accounts and reset the
passwords of the accounts. This topic describes how to create a Hue account and reset
its password.
Prerequisites
An EMR Hadoop cluster is created. For more information, see Create a cluster.
Create a Hue account
- Log on to your cluster in SSH mode. For more information, see Log on to a cluster.
- Run the following command to create an account:
/opt/apps/hue/build/env/bin/hue createsuperuser
- Enter the username, email address, and password, enter the password again, and then
press Enter.
If the message
Superuser created successfully appears, the account is created. You can log on to Hue by using the new account.
Reset the password of a Hue account
- Log on to your cluster in SSH mode. For more information, see Log on to a cluster.
- Run the following command to view the path of Hue:
ps aux | grep hue
Information similar to the following output is returned.
Note In this example, the path is /opt/apps/hue/build/env/bin/hue.
- Run the following command to start the Hue shell:
/opt/apps/hue/build/env/bin/hue shell
Note /opt/apps/hue/build/env/bin/hue in the command is the path obtained in
Step 2.
- Run the following command to reset the password of a Hue account:
from django.contrib.auth.models import User
user = User.objects.get(username='<your_username>')
user.set_password('<your_new_password>')
user.save()
Note Replace <your_username>
in the command with the username whose password you want to reset and replace <your_new_password>
with the new password. You can press Ctrl+D to exit the shell.
The following figure shows an example.
After you reset the password, you can log on to Hue by using the new password.