Windows Server 2025 重复 SID 导致 SMB 认证失败
2026/7/3大约 2 分钟
Windows Server 2025 重复 SID 导致 SMB 认证失败
Windows Server 2025 安装累积更新后,从 AMI 克隆的实例之间 SMB 访问认证失败,报"密码不正确",但密码实际没问题。根因是 Machine ID 校验机制检测到重复 SID。
问题现象
Windows Server 2025 安装最新累积更新后,从 AMI 克隆的实例之间 SMB 访问认证失败,报错"密码不正确",但密码实际没问题。
系统日志记录 Event ID 6167(LsaSrv):
There is a partial mismatch in the machine ID. This indicates that the ticket
issued by user S-1-5-21-xxx has either been manipulated or it belongs to a
different boot session. Failing authentication.
NOTE: This can also happen if the machine was cloned without using sysprep.前提条件
- Windows Server 2025 已安装最新累积更新
- 实例通过 AMI 克隆创建,未执行 Sysprep
确认方法
在两台机器上分别执行:
$sid = (New-Object System.Security.Principal.NTAccount('Administrator')).Translate([System.Security.Principal.SecurityIdentifier]).Value
$machineSid = $sid.Substring(0, $sid.LastIndexOf('-'))
Write-Output "Machine SID: $machineSid"如果输出的 Machine SID 完全一致,即可确认问题。
临时解决方案
通过注册表禁用 SID 唯一性检查(Known Issue Rollback 机制),SMB 服务端和客户端都需要设置:
New-Item -Path 'HKLM:\SYSTEM\CurrentControlSet\Policies\Microsoft\FeatureManagement\Overrides' -Force
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Policies\Microsoft\FeatureManagement\Overrides' -Name '1517186191' -Value 0 -Type DWord
Restart-Computer -Force限制:此临时方案有效期至 2027 年底,届时微软将在安全更新中移除该绕过能力。
永久解决方案
方案一:Sysprep 重新生成 SID(推荐)
N 台 SID 相同的机器,保留 1 台不动,其余 N-1 台执行 Sysprep:
# EC2 环境用 EC2Launch v2
& "C:\Program Files\Amazon\EC2Launch\EC2Launch.exe" sysprepSysprep 影响范围:
| 项目 | 是否受影响 |
|---|---|
| C 盘文件/数据 | 不丢 |
| 已安装软件 | 保留(绑定 SID 的授权可能需重新激活) |
| 用户配置文件 | 重置 |
| 计算机名 | 重置为随机名 |
| 域成员身份 | 脱域,需重新加域 |
| IP 地址 | 不变(EC2 私有 IP 绑定在 ENI 上) |
| Windows 激活 | 重置(EC2 上用 KMS 自动重新激活) |
方案二:第三方工具修改 SID
使用 SIDCHG 直接修改 Machine SID,无需退域和 OOBE:
sidchg64-3.0n.exe /R注意事项:非微软官方工具有风险;改 SID 后需修复域信任(Test-ComputerSecureChannel -Repair);需临时关闭 Defender 实时保护;EFS 加密文件、BitLocker 需提前处理。
Sysprep 报错排查
执行 Sysprep 时报错:
SYSPRP Package AppName_1.0.0.0_neutral__xxx was installed for a user,
but not provisioned for all users.移除问题 AppX 包:
Get-AppxPackage -AllUsers *AppName* | ForEach-Object {
Remove-AppxPackage -Package $_.PackageFullName -AllUsers -ErrorAction SilentlyContinue
}
Get-AppxProvisionedPackage -Online | Where-Object {
$_.DisplayName -like "*AppName*"
} | Remove-AppxProvisionedPackage -Online预防措施
制作 AMI 前执行 Sysprep,确保每台实例都有唯一 SID。将此纳入镜像制作规范。
