Skip to content

使用谷歌验证器2FA

信息

下述配置无法通过实际测试, 请不要使用.

测试环境

Debian12 服务器

解决方案

  1. 安装包: sudo apt install libpam-google-authenticator

  2. 配置SSH:

    • 编辑/etc/pam.d/sshd文件, 加入下列行: auth required pam_google_authenticator.so
    • 重启sshd: sudo systemctl restart sshd.service
    • 编辑/etc/ssh/sshd_config: 将ChallengeResponseAuthenticationno改为yespdf
  3. 配置Google Authenticator: 输入命令google-authenticator, 按照提示选择配置:

    • Make tokens “time-base””: yes
    • Update the .google_authenticator file: yes
    • Disallow multiple uses: yes
    • Increase the original generation time limit: no
    • Enable rate-limiting: yes

    扫码, 记录下紧急代码

采用 CC BY-NC 4.0 许可证发布