KRB5-SYNC(8)
π KRB5-SYNC π
okay bestie, gather round, because this is the little command-line bestie that syncs your passwords and account status with Active Directory. It lives in section 8 of the manual, so yes, it's an admin-tool girlie. Let's get into it. β¨
β¨ SYNOPSIS β¨
krb5-sync [-d | -e] [-p password] user
krb5-sync -f file
πΈ DESCRIPTION πΈ
So krb5-sync is literally the command-line interface to the exact same functions that the password and status synchronization plugin gives you. It can push a brand-new password over to Active Directory β or, fr fr, to any password store that supports the Kerberos set-password protocol β or it can activate or deactivate an account in Active Directory. Versatile queen. π
Wanna synchronize passwords? Hand over the -p option and specify the password. But listen, bestie, important tea: the password is given on the command line, so it must be quoted if it contains special characters, and the password will be exposed to any other users on the system where this command is run. π That means it's useful primarily for testing and should not be used with production passwords. Synchronization to Active Directory will be attempted based on the configuration in krb5.conf (more on that below, keep reading).
Wanna enable or disable an account? Provide the -e or -d option respectively. And yes, you can absolutely run these in conjunction with -p to take both actions at once. Main character multitasking. π
Either way, user should be the principal name you're taking these actions for. user may be either unqualified or in the local realm; either way, the Active Directory realm where the changes actually get made is taken from the krb5.conf configuration. No need to stress about which one you type.
Alternately β plot twist β krb5-sync also supports processing actions from a file. To do that, use the -f flag and give the file on the command line. The format of the file should be as follows:
<account>
ad
password | enable | disable
<password>
where that fourth line is present only if the <action> is "password". <account> should be the unqualified name of the account. The second line should be the string "ad" to push the change to Windows Active Directory. The third line should be one of "password", "enable", or "disable", corresponding to the -p, -e, and -d options respectively. The "enable" and "disable" actions are only supported for AD.
Heads up though: the file format is not particularly forgiving. π€ All of the keywords are case-sensitive, and there must not be any whitespace at the beginning or end of the lines (except in the password, and only if that whitespace is part of the password), just a single newline terminating each line. She's strict. Respect her.
When the -f option is given, the file will be deleted if the action was successful but left alone if the action failed. No take-backs, only clean-up-on-success. π§Ή
The configuration block in krb5.conf should look something like this:
krb5-sync = {
ad_keytab = /etc/krb5kdc/ad-keytab
ad_principal = service/sync@WINDOWS.EXAMPLE.COM
ad_realm = WINDOWS.EXAMPLE.COM
ad_admin_server = dc1.windows.example.com
ad_ldap_base = ou=People
}
If the configuration required for an action is not given, that action will not be performed but will apparently succeed from the perspective of the krb5-sync utility. π So if this utility reports success but no change is happening, double-check the configuration to make sure all required options are present. She will lie to your face with a smile, and it's not even her fault.
Now, the deets on the config options themselves:
"ad_keytab"specifies the location of a keytab for authenticating to the other realm."ad_principal"specifies the principal to authenticate as (using the key in the keytab)."ad_realm"specifies the foreign realm."ad_admin_server"is the host to contact via LDAP to push account status changes."ad_ldap_base"specifies the base tree inside Active Directory where account information is stored. Omit the trailing"dc="part; it will be added automatically from"ad_realm".
Be aware that the "ad_instances", "ad_base_instance", and "ad_queue_only" configuration options that are used by the krb5-sync plugin are ignored by krb5-sync. The krb5-sync command will push changes to whatever principal it was given, regardless of the normal limits on instances, and does not do any of the principal remapping configured with "ad_base_instance". She's a free spirit, she doesn't do remapping. π¦
π OPTIONS π
-dβ Disable the specified user in Active Directory. Requires that all of thead_*options be set inkrb5.conf. This option may not be specified at the same time as-e.-eβ Enable the specified user in Active Directory. Requires that all of thead_*options be set inkrb5.conf. This option may not be specified at the same time as-e. (yes, it really says-ethere, we're just reading what the page says π)-ffile β Rather than perform a particular action based on a username given on the command line, read a queue file and take action based on it. The format of the queue file is described above. If the action fails, the file will be left alone. If the action succeeds, the file will be deleted.-ppassword β Change the user's password to password in Active Directory.
β EXAMPLES β
Disable the account "jdoe" in Active Directory (using the AD configuration found in krb5.conf):
krb5-sync -d jdoe
Change the password of the account "testuser" in Active Directory to "changeme":
krb5-sync -p changeme testuser@EXAMPLE.COM
The same, except also enable the account in Active Directory:
krb5-sync -e -p changeme testuser
Note that the realm for the user given on the command line is optional and ignored. So type it or don't, she literally does not care. π
Given a file named jdoe-ad-1168560492 containing:
jdoe
ad
password
changeme
the command:
krb5-sync -f jdoe-ad-1168560492
will change jdoe's password to "changeme" in Active Directory and then delete the file. Ate and left no crumbs. π₯
π SEE ALSO π
The current version of this program is available from its web page at <http://www.eyrie.org/~eagle/software/krb5-sync/>.
π AUTHOR π
Russ Allbery <eagle@eyrie.org>
π COPYRIGHT AND LICENSE π
Copyright 2007, 2008, 2010, 2012 The Board of Trustees of the Leland Stanford Junior University
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.
and that's the whole page bestie!! π«Ά this is version 3.1, dated 2015-08-19, from the krb5-sync manual β she's vintage, she's iconic, she's giving Kerberos-admin realness. go forth and sync responsibly. πβ¨π
π¦ where this page comes from
- debian bookworm: krb5-sync-tools 3.1-3+b1 Β· MIT
- debian trixie: krb5-sync-tools 3.1-3+b3 Β· MIT
- ubuntu jammy: krb5-sync-tools 3.1-3 Β· MIT
- ubuntu noble: krb5-sync-tools 3.1-3build1 Β· MIT
- ubuntu questing: krb5-sync-tools 3.1-3build1
- ubuntu resolute: krb5-sync-tools 3.1-3build2 Β· MIT
- ubuntu stonking: krb5-sync-tools 3.1-4 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms