设置账户锁定策略(net accounts)

连续输错密码后自动锁定账户 30 分钟,防止别人反复试你的密码。

Windows策略账户安全中风险
在管理员命令提示符中运行 net accounts /lockoutthreshold:5 /lockoutduration:30 /lockoutwindow:30。

01命令

命令
$ net accounts /lockoutthreshold:5 /lockoutduration:30 /lockoutwindow:30

02作用说明

不设锁定的话,任何人都可以无限次猜测你的密码。/lockoutthreshold:5 表示连续错 5 次后锁定账户,/lockoutduration:30 表示锁定 30 分钟,/lockoutwindow:30 表示在这 30 分钟窗口内累计计算失败次数。直接运行 net accounts 可查看当前策略。

03风险

风险中风险
使用条件Run Command Prompt as administrator. Values: threshold = wrong attempts, duration/window in minutes.
!注意: 锁定策略生效后,自己也得等锁定时间结束(或让其他管理员解锁)才能登录——别把阈值设得太低坑到自己。

04撤销

撤销
$ net accounts /lockoutthreshold:0

05来源

  • net - Windows CMD
    SS64 · technical · 2026-09-17
    依据: Covers the net accounts options including /lockoutthreshold, /lockoutduration and /lockoutwindow for configuring account lockout.

最后验证: 2026-09-18 · 分类: 安全与隐私

06相关方案