Skip to content

Instantly share code, notes, and snippets.

@vijayjt
vijayjt / kinit_as_hadoop_system_user.sh
Created Jan 7, 2017
Easiest way to kinit as hdfs, hive or another Hadoop system user with CDH
View kinit_as_hadoop_system_user.sh
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