K5IDENTITY(5)
π k5identity β Kerberos V5 client principal selection rules π
okay so this is K5IDENTITY(5) from the MIT Kerberos manual, and bestie, it's genuinely one of the cutest little config files ever. let's get into it β¨
πΈ NAME πΈ
k5identity β the Kerberos V5 client principal selection rules. it's giving "who am I gonna be today" but for your credentials π
π¦ DESCRIPTION π¦
so the .k5identity file lives in your home directory (yes, your home directory, it's a whole personal vibe) and it's basically a list of rules for picking which client principal to use based on which server you're hitting up. these rules get used to choose a credential cache inside the cache collection when that's possible. very main character energy π
blank lines are ignored. lines starting with # are ignored too. so you can comment and breathe, it's fine π«Ά
every line has this shape:
principal field=value ...
if the server principal satisfies all the field constraints on a line, then that line's principal wins and becomes your client principal. slay. the fields it recognizes are:
realmβ if the realm of the server principal is actually known, it gets matched against value, and value can be a pattern using shell wildcards. β¨ heads up though: for host-based server principals, the realm is generally only known if there's a[domain_realm]section inkrb5.confwith a mapping for that hostname. no mapping, no realm knowledge, no cap π§’serviceβ if the server principal is a host-based principal, its service component gets matched against value, which may be a pattern using shell wildcards. iconic field name tbh πhostβ if the server principal is a host-based principal, its hostname component gets converted to lowercase and then matched against value, which may be a pattern using shell wildcards. lowercase supremacy fr fr π
and here's the rule that actually matters, so listen up π β if the server principal matches the constraints of multiple lines in .k5identity, the principal from the first matching line is used. first come, first served, periodt. and if no line matches? then credentials get selected some other way, like the realm heuristic or the current primary cache. it's not a crisis, it's just a different vibe π
π EXAMPLE π
okay here's a real example .k5identity file and honestly it eats π₯ it picks the client principal alice@KRBTEST.COM whenever the server principal is inside that realm, picks alice/root@EXAMPLE.COM when the server host is inside a servers subdomain, and picks alice/mail@EXAMPLE.COM when you're accessing the IMAP service on mail.example.com:
alice@KRBTEST.COM realm=KRBTEST.COM
alice/root@EXAMPLE.COM host=*.servers.example.com
alice/mail@EXAMPLE.COM host=mail.example.com service=imap
see how it's just vibes and wildcards? obsessed π
π§ SEE ALSO π§
kerberos(1)krb5.conf
go read those too, iykyk π
β AUTHOR β
MIT β the whole thing π
πΈ COPYRIGHT πΈ
1985-2026, MIT
and that's the whole page bestie π«Ά written by MIT, from the MIT Kerberos fam, version 1.22.2 β mwah, go forth and select your principals π
β¨π
π¦ where this page comes from
- alpine 3.24: krb5-doc 1.22.2-r1 Β· MIT
- arch rolling: krb5 1.22.2-1 Β· custom
- fedora 43: krb5-libs 1.22.2-4.fc43 Β· Brian-Gladman-2-Clause AND BSD-2-Clause AND (BSD-2-Clause OR GPL-2.0-or-later) AND BSD-2-Clause-first-lines AND BSD-3-Clause AND BSD-4-Clause AND CMU-Mach-nodoc AND FSFULLRWD AND HPND AND HPND-export2-US AND HPND-export-US AND HPND-export-US-acknowledgement AND HPND-export-US-modify AND ISC AND MIT AND MIT-CMU AND OLDAP-2.8 AND OpenVision
- fedora 43: krb5-libs 1.22.2-4.fc43 Β· Brian-Gladman-2-Clause AND BSD-2-Clause AND (BSD-2-Clause OR GPL-2.0-or-later) AND BSD-2-Clause-first-lines AND BSD-3-Clause AND BSD-4-Clause AND CMU-Mach-nodoc AND FSFULLRWD AND HPND AND HPND-export2-US AND HPND-export-US AND HPND-export-US-acknowledgement AND HPND-export-US-modify AND ISC AND MIT AND MIT-CMU AND OLDAP-2.8 AND OpenVision
- freebsd 15.1: base 15.1
- nixos 26.05: krb5 1.22.2
- nixpkgs unstable: krb5 1.22.2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms