RPC_NT_SEC_PKG_ERROR 0XC0020057 fix: Kerberos auth fails
This error pops up when Windows can't authenticate with a domain controller because of broken Kerberos tickets or time sync issues. Here's the quick fix.
You're trying to join a computer to the domain, or maybe you're logging into a domain-joined machine, and you get this error. The exact message is 'RPC_NT_SEC_PKG_ERROR (0XC0020057) - A security package-specific error occurred'. I've seen this mostly on Windows 10 22H2 and Server 2019 when the time on the workstation drifts more than 5 minutes from the domain controller. Another common trigger is after you change the domain controller's password or rebuild a DC without doing proper metadata cleanup.
What's really happening here
The error code 0xC0020057 is a Kerberos sub-error. It means the security package—Kerberos in this case—couldn't complete the handshake. The culprit is almost always a bad Kerberos ticket cache or a clock skew that's too big. Kerberos relies on synchronized time between client and server. If they're off by more than 5 minutes (by default), the whole authentication fails with this error. Don't bother checking network connectivity first—it's rarely the issue. Run w32tm /stripchart /computer:DC01 to see the time difference right away.
The fix in 4 steps
- Purge old Kerberos tickets. Open Command Prompt as admin and run
klist purge. This clears all cached tickets. Then runklistto confirm it's empty. I've fixed probably 30 machines just with this one command. - Sync the time. Run
w32tm /resync /force. If that fails, stop the time service first:net stop w32time, thenw32tm /unregister, thenw32tm /register, thennet start w32time, thenw32tm /resync. This re-registers the service and forces a sync. - Reset the machine account. If the error persists, the computer's domain account might be corrupt. On the domain controller, run
netdom resetpwd /Server:DC01 /UserD:DOMAIN\Admin /PasswordD:*. You'll need domain admin creds for this. This resets the machine password without rejoining the domain. - Rejoin the domain as last resort. If nothing works, unjoin the machine from the domain (put it in a workgroup), reboot, then rejoin. Use
netdom joinor the System Properties GUI. I've had to do this maybe 1 in 20 times.
What else to check if it still fails
If you're still stuck, check these three things:
- DNS. Make sure the client can resolve the domain controller's FQDN. Run
nslookup DC01.yourdomain.local. If it fails, fix DNS first—Kerberos needs SRV records to work. - Event logs. Look in Event Viewer > Windows Logs > System for Event ID 4 from source NETLOGON. It usually says 'The kerberos client received a time skew error' or similar. That points straight to clock issues.
- Firewall. Check that ports 88 (Kerberos) and 464 (Kerberos password change) are open between client and domain controller. I've seen a misconfigured firewall block these on client subnet.
Skip the fancy tools. The fix is almost always step 1 or 2. If you're still stuck after step 4, you might have a corrupt local SAM database, which is rare but happens. In that case, back up data and reinstall Windows clean.
Was this solution helpful?