我正在尝试配置我的服务器以禁用密码身份验证,我现在正在使用密钥。问题是PasswordAuthentication no设置了,但是没有效果。即使设置了密码,我仍然会被提示输入密码。我正在从 Windows 10 上的 PuTTY 连接到 Ubuntu Server 14.04。showsssh -v先使用我的键,然后再使用键盘交互。我确保我编辑过sshd_config,而不是ssh_config。我ssh在应用更改后重新启动,当没有效果时,我重新启动了整个服务器,仍然没有效果。我在另一台 14.04 服务器上有这个完全相同的配置文件,密钥完全相同,但它没有问题,密码验证在那里被禁用。
为什么密码验证没有按原样禁用,我该如何解决?
sshd_config为简洁起见,这是整个文件减去所有注释行。
Port 612
Protocol 2
HostKey /etc/ssh/ssh_host_ed25519_key
HostKey /etc/ssh/ssh_host_rsa_key
KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256,diffie-hellman-group1-sha1
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com
UsePrivilegeSeparation yes
KeyRegenerationInterval 3600
ServerKeyBits 1024
SyslogFacility AUTH
LogLevel INFO
LoginGraceTime 120
PermitRootLogin no
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no
PermitEmptyPasswords no
PasswordAuthentication no
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
UsePAM yes
Run Code Online (Sandbox Code Playgroud)
问题是,使用的密码身份验证PAM(在所有现代系统上)是由ChallengeResponseAuthentication选项处理的,yes默认情况下。
质询响应认证
指定是否允许质询-响应身份验证(例如,通过 PAM)。默认值为“是”。
这在示例中多次提到sshd_config。
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
Run Code Online (Sandbox Code Playgroud)
将它添加到您的sshd_configwith value no,重新启动,它将为您工作:
ChallengeResponseAuthentication no
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4823 次 |
| 最近记录: |