Linux   发布时间:2022-04-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了linux – 当UsePAM设置为“no”时,SSH公钥验证失败大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

要禁用密码身份验证,我在sshd_config中设置了以下值 ChALLENgeResponseAuthentication no passwordAuthentication no UsePAM no 当我尝试使用我的私钥登录时,我得到了 Permission denied (publickey). 如果我然后将usePAM更改为是,我可以使用我的私钥登录.为什么? 我正在从OSX连接到Ubun
要禁用密码身份验证,我在sshd_config中设置了以下值
ChALLENgeResponseAuthentication no
passwordAuthentication no
UsePAM no

当我尝试使用我的私钥登录时,我得到了

Permission denied (publickey).

如果我然后将usePAM更改为是,我可以使用我的私钥登录.为什么?

我正在从OSX连接到Ubuntu 12.04 64位主机

ssh -i ~/.ssh/deploy -l deploy localhost -p 2222 -v

这是详细的ssh输出

OpenSSH_5.9p1,OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /Users/<user>/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: ConnecTing to localhost [127.0.0.1] port 2222.
debug1: Connection established.
debug1: identity file /Users/<user>/.ssh/deploy type 1
debug1: identity file /Users/<user>/.ssh/deploy-cert type -1
debug1: Remote protocol version 2.0,remote software version OpenSSH_5.9p1 Debian-5ubuntu1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version String SSH-2.0-OpenSSH_5.9
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_requEST(1024<1024<8192) sent
debug1: expecTing SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecTing SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 50:db:75:ba:11:2f:43:c9:ab:14:40:6d:7f:a1:ee:e3
debug1: Host '[localhost]:2222' is kNown and matches the RSA host key.
debug1: Found key in /Users/<user>/.ssh/kNown_hosts:2
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecTing SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: roaR_858_11845@ing not allowed by server
debug1: SSH2_MSG_serviCE_requEST sent
debug1: SSH2_MSG_serviCE_ACCEPT received
debug1: Authentications that can conTinue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/<user>/.ssh/key1
debug1: Authentications that can conTinue: publickey
debug1: Offering RSA public key: /Users/<user>/.ssh/deploy
debug1: Authentications that can conTinue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

解决方法

如果没有PAM(可插入的身份验证模块),则需要更复杂的ssh配置进行身份验证.你正在寻找这个,实际上:
# grep password /etc/ssh/sshd_config 
PermitEmptypasswords no
passwordAuthentication no

这将禁用passworded登录.确保正确建立公钥设置.

大佬总结

以上是大佬教程为你收集整理的linux – 当UsePAM设置为“no”时,SSH公钥验证失败全部内容,希望文章能够帮你解决linux – 当UsePAM设置为“no”时,SSH公钥验证失败所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。