Skip to content

Commit

Permalink
SSH 登录失败后锁定时间限制
Browse files Browse the repository at this point in the history
  • Loading branch information
jangrui committed Jun 29, 2024
1 parent 13d2f8c commit 607b411
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/linux/ssh 登录失败后锁定时间限制.md
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
```
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ markdown_extensions:
nav:
- Home: index.md
- Linux:
- SSH 登录失败后锁定时间限制: linux/SSH 登录失败后锁定时间限制.md
# - CentOS 系统初始化: linux/centos-init.md
# - Bash:
# - 作者: linux/bash/author.md
Expand Down

0 comments on commit 607b411

Please sign in to comment.