How to Run Hue Shell Commands
You may need to administer Hue programmatically, for example, to reset the superuser password or assign an LDAP user superuser permissions. This page addresses managed deployments of CDH 5.5 and higher.
- Set HUE_CONF_DIR to the latest Hue process directory:
export HUE_CONF_DIR="/var/run/cloudera-scm-agent/process/`ls -alrt /var/run/cloudera-scm-agent/process | grep HUE_SERVER | tail -1 | awk '{print $9}'`" echo $HUE_CONF_DIR
- Set environment variables used to run the Hue webserver.:
for line in `strings /proc/$(lsof -i :8888|grep -m1 python|awk '{ print $2 }')/environ|egrep -v "^HOME=|^TERM=|^PWD="`;do export $line;done
- Run shell subcommands
When true, HUE_IGNORE_PASSWORD_SCRIPT_ERRORS runs the Hue shell even if hue.ini contains passwords generated by Cloudera Manager (such as bind_password and ssl_password).
For CDH parcel deployments:
- Run the interactive Hue Python shell (Ctrl+D to quit)
HUE_IGNORE_PASSWORD_SCRIPT_ERRORS=1 /opt/cloudera/parcels/CDH/lib/hue/build/env/bin/hue shell
Or with the database password:
HUE_IGNORE_PASSWORD_SCRIPT_ERRORS=1 HUE_DATABASE_PASSWORD=<your db password> /opt/cloudera/parcels/CDH/lib/hue/build/env/bin/hue shell
- Change a user password
HUE_IGNORE_PASSWORD_SCRIPT_ERRORS=1 /opt/cloudera/parcels/CDH/lib/hue/build/env/bin/hue changepassword admin
- Promote Hue user to superuser
HUE_IGNORE_PASSWORD_SCRIPT_ERRORS=1 /opt/cloudera/parcels/CDH/lib/hue/build/env/bin/hue shell
>>> from django.contrib.auth.models import User >>> a = User.objects.get(username='gwen') >>> a.is_superuser = True >>> a.save()
- List available subcommands
HUE_IGNORE_PASSWORD_SCRIPT_ERRORS=1 /opt/cloudera/parcels/CDH/lib/hue/build/env/bin/hue
For CDH package deployments:-
HUE_IGNORE_PASSWORD_SCRIPT_ERRORS=1 /usr/lib/hue/build/env/bin/hue shell
- Run the interactive Hue Python shell (Ctrl+D to quit)
For unmanaged and lower CDH versions, see: