How to create a keytab for an user

First obtain Kerberos ticket with kinit:

$ kinit [email protected]
Password for [email protected]:

Then obtain kvno value:

Ticket is no longer needed and can be destroyed:

$ kdestroy -p [email protected]

Generate keytab and write it to disk:

$ ktutil
ktutil:  addent -password -p [email protected] -k 42 -f
Password for [email protected]:
ktutil:  wkt /tmp/kt/fedora
ktutil:  q

Done. You can now use the keytab to obtain the ticket without typing password:

$ kinit -kt /tmp/kt/fedora [email protected]