使用谷歌验证器2FA¶
信息
下述配置无法通过实际测试, 请不要使用.
测试环境¶
Debian12 服务器
解决方案¶
- 安装包:
sudo apt install libpam-google-authenticator
- 配置SSH:
- 编辑
/etc/pam.d/sshd
文件, 加入下列行:auth required pam_google_authenticator.so
- 重启sshd:
sudo systemctl restart sshd.service
- 编辑
/etc/ssh/sshd_config
: 将ChallengeResponseAuthentication
从no
改为yes
pdf
- 编辑
-
配置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
扫码, 记录下紧急代码