Tips for finding Knowledge Articles

  • - Enter just a few key words related to your question or problem
  • - Add Key words to refine your search as necessary
  • - Do not use punctuation
  • - Search is not case sensitive
  • - Avoid non-descriptive filler words like "how", "the", "what", etc.
  • - If you do not find what you are looking for the first time,reduce the number of key words you enter and try searching again.
  • - Minimum supported Internet Explorer version is IE9
Home  >

KB-1666: Setup cron job with AD user kerberos credential

Auditing and Monitoring Service ,   Authentication Service ,   Mac & PC Management Service ,  

12 April,16 at 11:12 AM


I want to setup a cron job with AD user. What is the potential risk if I setup cron job by AD user credential? What is prerequisite to do so? Can you list out the detail steps?


There is security risk when you setup cron job with AD user credential. The keytab file contains kerberos password hash for AD user that can be read by root.

DirectControl 4.4.1 ensures crond starts after adclient ready, so that ensure the crond job can be run as AD user. 

Steps for setup cronjob for AD user with kerberos credential: 

(1) create SPN for the AD user:

(a) on windows side,

setspn -A cron/<aduser> <aduser>


(b) on a joined Linux/Unix machine, run as root,

adkeytab -a -u <ad-admin> -P cron/<aduser> <aduser>


(2) create keytab for <aduser>:

on Unix/Linux side, as root,

adkeytab -A -K /etc/<aduser>.keytab -u <ad-admin> -p <ad-admin-pswd> --local –w <aduser-passwd> <aduser>

e.g. adkeytab -A -K /etc/test113.keytab -u administrator -p <admin-pwd> --local –w <test113-pwd> test113

(3) chown <aduser>:<adgroup> /etc/<aduser>.keytab

(4) to verify content, run as <aduser>,

/usr/share/centrifydc/kerberos/bin/klist -kt /etc/<aduser>.keytab

/etc/<aduser>.keytab now contains the password hash for kinit to obtain kerberos credential as <aduser>.

Add in cron job script:

/usr/share/centrifydc/kerberos/bin/kinit -kt /etc/<aduser>.keytab <aduser>

This create kerberos ticket cache for the AD user - that can be used to do SSO ssh with, from inside the cron script, for example.

To verify user kerberos credential is present, add line in cron script to see:


Important notes:

(A)  /etc/<aduser>.keytab needs to be re-created after <aduser> password change. so, simply:

rm /etc/<aduser>/keytab, and redo step (2) and (3).

(B) the keytab file /etc/<aduser>.keytab can be copied from host to host - this is tied to the AD user, not to the machine.