小编Tim*_*thy的帖子

OpenSSH 使用(公钥或密码)+ google 验证器

我想允许这两种身份验证类型:公钥 + 谷歌身份验证器密码 + 谷歌身份验证器。

我有以下内容sshd_config

AuthenticationMethods publickey,keyboard-interactive:pam password,keyboard-interactive:pam
UsePAM yes
ChallengeResponseAuthentication yes
PubkeyAuthentication yes
PasswordAuthentication yes
Run Code Online (Sandbox Code Playgroud)

而在/etc/pam.d/ssh我取消注释

#@include common-auth and added auth required pam_google_authenticator.so
Run Code Online (Sandbox Code Playgroud)

在文件的末尾。

密钥 + 令牌路由仍然有效,但由于某种原因,我的密码总是被拒绝并显示“拒绝访问”消息。

我发现每当我设置UsePAM为“是”时,密码验证都会失败。不知道为什么?

/etc/pam.d/sshd 的内容:(这个文件对我来说似乎很长,但它只是 ubuntu 的默认值,也许我可以缩短它?)

# PAM configuration for the Secure Shell service

# Standard Un*x authentication.
#@include common-auth

# Disallow non-root logins when /etc/nologin exists.
account    required     pam_nologin.so

# Uncomment and edit /etc/security/access.conf if you need to set     complex
# access limits …
Run Code Online (Sandbox Code Playgroud)

ssh pam

5
推荐指数
1
解决办法
2282
查看次数

标签 统计

pam ×1

ssh ×1