Skip to content

Instantly share code, notes, and snippets.

@vijayjt
Created January 7, 2017 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vijayjt/579c8b2d0bcf320e82cfd9f528c95ec5 to your computer and use it in GitHub Desktop.
Save vijayjt/579c8b2d0bcf320e82cfd9f528c95ec5 to your computer and use it in GitHub Desktop.
Easiest way to kinit as hdfs, hive or another Hadoop system user with CDH
export HDPUSER='hive'
export DOMAIN=$(dnsdomainname)
export PKEYTAB=$(ls -Rt /var/run/cloudera-scm-agent/process/*/*keytab | grep $HDPUSER | head -1)
export PRINC=$(klist -kt $PKEYTAB | grep -v FILE | grep $HDPUSER | awk '{print $4}')
kinit -V -kt $PKEYTAB $PRINC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment