Skip to content

Instantly share code, notes, and snippets.

@vijayjt
vijayjt / kinit_as_hadoop_system_user.sh
Created January 7, 2017 18:00
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