-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# SSH 登录失败后锁定时间限制 | ||
|
||
在 Linux7 中,你可以通过修改 /etc/pam。d/system--auth 文件来配置重复登录失败后锁定时间限制。具体步骤如下: | ||
|
||
1.打开 `/etc/pam.d/system-auth` 文件,找到 auth 部分。 | ||
|
||
2.在 auth 部分添加如下配置: | ||
|
||
```bash | ||
auth required pam_faillock。so preauth silent audit deny=3 unlock_time=600 | ||
auth [default=die]pam_faillock.so authfail audit deny=3 unlock_time=600 | ||
``` | ||
|
||
!!! tip | ||
|
||
- `deny`:表示允许失败的最大次数,这里设置为 3; | ||
- `unlock_time`:表示账户被锁定的时间,单位为秒,这里设置为 600秒(即10分钟) | ||
|
||
3.保存文件并退出。 | ||
|
||
4.重新加载 PAM 配置: | ||
|
||
```bash | ||
authconfig --update --force | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters