linux – sshd忽略authorized_keys并继续尝试authorized_keys2

我刚刚将我的公钥上传到服务器,确保权限是正确的,当我尝试记录它时,只是拒绝它.

在sshd_config中启用loglevel DEBUG后,我得到:

Nov 22 06:53:36 host-1 sshd[8612]: debug1: Forked child 8617.
Nov 22 06:53:36 host-1 sshd[8617]: Set /proc/self/oom_score_adj to 0
Nov 22 06:53:36 host-1 sshd[8617]: debug1: rexec start in 5 out 5 newsock 5 pipe 7 sock 8
Nov 22 06:53:36 host-1 sshd[8617]: debug1: inetd sockets after dupping: 3,3
Nov 22 06:53:36 host-1 sshd[8617]: Connection from some_ip port 50466
Nov 22 06:53:36 host-1 sshd[8617]: debug1: HPN Disabled: 0,HPN Buffer Size: 87380
Nov 22 06:53:36 host-1 sshd[8617]: debug1: Client protocol version 2.0; client software version OpenSSH_6.0p1 Debian-3
Nov 22 06:53:36 host-1 sshd[8617]: SSH: Server;Ltype: Version;Remote: some_ip-50466;Protocol: 2.0;Client: OpenSSH_6.0p1 Debian-3
Nov 22 06:53:36 host-1 sshd[8617]: debug1: match: OpenSSH_6.0p1 Debian-3 pat OpenSSH*
Nov 22 06:53:36 host-1 sshd[8617]: debug1: Remote is NON-HPN aware
Nov 22 06:53:36 host-1 sshd[8617]: debug1: Enabling compatibility mode for protocol 2.0
Nov 22 06:53:36 host-1 sshd[8617]: debug1: Local version string SSH-2.0-OpenSSH_5.8p1-hpn13v10
Nov 22 06:53:36 host-1 sshd[8617]: debug1: Config token is loglevel
Nov 22 06:53:36 host-1 sshd[8617]: debug1: Config token is passwordauthentication
Nov 22 06:53:36 host-1 sshd[8617]: debug1: Config token is permitemptypasswords
Nov 22 06:53:36 host-1 sshd[8617]: debug1: Config token is usepam
Nov 22 06:53:36 host-1 sshd[8617]: debug1: Config token is subsystem
Nov 22 06:53:36 host-1 sshd[8617]: debug1: temporarily_use_uid: 1000/1000 (e=0/0)
Nov 22 06:53:36 host-1 sshd[8617]: debug1: trying public key file /home/xxx/.ssh/authorized_keys
Nov 22 06:53:36 host-1 sshd[8617]: debug1: fd 4 clearing O_NONBLOCK
Nov 22 06:53:36 host-1 sshd[8617]: debug1: restore_uid: 0/0
Nov 22 06:53:36 host-1 sshd[8617]: debug1: temporarily_use_uid: 1000/1000 (e=0/0)
Nov 22 06:53:36 host-1 sshd[8617]: debug1: trying public key file /home/xxx/.ssh/authorized_keys2
Nov 22 06:53:36 host-1 sshd[8617]: debug1: Could not open authorized keys '/home/xxx/.ssh/authorized_keys2': No such file or directory
Nov 22 06:53:36 host-1 sshd[8617]: debug1: restore_uid: 0/0
Nov 22 06:53:36 host-1 sshd[8617]: Failed publickey for xxx from some_ip port 50466 ssh2
Nov 22 06:53:36 host-1 sshd[8617]: debug1: temporarily_use_uid: 1000/1000 (e=0/0)
Nov 22 06:53:36 host-1 sshd[8617]: debug1: trying public key file /home/xxx/.ssh/authorized_keys
Nov 22 06:53:36 host-1 sshd[8617]: debug1: fd 4 clearing O_NONBLOCK
Nov 22 06:53:36 host-1 sshd[8617]: debug1: restore_uid: 0/0
Nov 22 06:53:36 host-1 sshd[8617]: debug1: temporarily_use_uid: 1000/1000 (e=0/0)
Nov 22 06:53:36 host-1 sshd[8617]: debug1: trying public key file /home/xxx/.ssh/authorized_keys2
Nov 22 06:53:36 host-1 sshd[8617]: debug1: Could not open authorized keys '/home/xxx/.ssh/authorized_keys2': No such file or directory
Nov 22 06:53:36 host-1 sshd[8617]: debug1: restore_uid: 0/0
Nov 22 06:53:36 host-1 sshd[8617]: Failed publickey for xxx from some_ip port 50466 ssh2
Nov 22 06:53:36 host-1 sshd[8617]: debug1: do_cleanup

它继续尝试authorized_keys2(我虽然到处都弃用了)但是它确实在某个时候打开了authorized_keys(带有我的键的正确文件)然后再说完全没有关于它并返回到authorized_keys2

这有什么不对?

我的sshd_config中有:

PubkeyAuthentication yes
AuthorizedKeysFile      .ssh/authorized_keys

并且该文件中没有authorized_keys2字符串.是的,sshd在测试之前重新启动.

我想我可以使用authorized_keys2,但想了解这里发生了什么.有什么线索吗?

编辑:ssh -v host

client$ssh -v host
OpenSSH_6.0p1 Debian-3,OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to host [someip] port 22.
debug1: Connection established.
debug1: identity file /home/xxx/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/xxx/.ssh/id_rsa-cert type -1
debug1: identity file /home/xxx/.ssh/id_dsa type 2
debug1: Checking blacklist file /usr/share/ssh/blacklist.DSA-1024
debug1: Checking blacklist file /etc/ssh/blacklist.DSA-1024
debug1: identity file /home/xxx/.ssh/id_dsa-cert type -1
debug1: identity file /home/xxx/.ssh/id_ecdsa type -1
debug1: identity file /home/xxx/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0,remote software version OpenSSH_5.8p1-hpn13v10
debug1: match: OpenSSH_5.8p1-hpn13v10 pat OpenSSH_5*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.0p1 Debian-3
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: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA xx:xx...
debug1: Host 'host' is known and matches the ECDSA host key.
debug1: Found key in /home/xxx/.ssh/known_hosts:11
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering DSA public key: /home/xxx/.ssh/id_dsa
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Offering RSA public key: /home/xxx/.ssh/id_rsa
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Trying private key: /home/xxx/.ssh/id_ecdsa
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Next authentication method: password
xxx@host's password:

解决方法

当它找不到有效的authorized_keys文件时,由于兼容性原因,它似乎回退到authorized_keys2.检查您的authorized_keys文件是否正确形成.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


文章浏览阅读1.8k次,点赞63次,收藏54次。Linux下的目录权限!!!粘滞位!!!超详解!!!
文章浏览阅读1.6k次,点赞44次,收藏38次。关于Qt的安装、Windows、Linux、MacBook_mack book 安装qt
本文介绍了使用shell脚本编写一个 Hello
文章浏览阅读1.5k次,点赞37次,收藏43次。【Linux】初识Linux——了解操作系统的发展历史以及初次体验Linux编程环境
文章浏览阅读3k次,点赞34次,收藏156次。Linux超详细笔记,个人学习时很认真的记录的,觉得好的麻烦点个赞。
文章浏览阅读6.8k次,点赞109次,收藏114次。【Linux】 OpenSSH_9.3p1 升级到 OpenSSH_9.5p1(亲测无问题,建议收藏)_openssh_9.5p1
文章浏览阅读3.5k次,点赞93次,收藏78次。初识Linux中的线程,理解线程的各种概念,理解进程地址空间中的页表转换,介绍pthread线程库并理解线程库!
文章浏览阅读863次。出现此问题为Linux文件权限问题,解决方案为回到引擎目录执行命令。输入用户密码后运行./UnrealEditor。_increasing per-process limit of core file size to infinity.
文章浏览阅读2.9k次。使用文本编辑器:打开CSV文件,并使用文本编辑器(如Notepad++、Sublime Text、Visual Studio Code等)来查看文件的字符编码格式。通常在编辑器的底部状态栏或设置中可以找到当前编码的显示。请注意,上述方法并非绝对准确,特别是当文件没有明确的编码标识时。因此,如果你发现CSV文件在不同的工具或方法中显示不同的编码格式,可能需要进行进一步的分析和判断,或者尝试使用不同的编码转换方法。该命令将输出文件的MIME类型和编码信息。使用命令行工具:在命令行中,你可以使用。_shell读取csv文件逐行处理
本文介绍了如何在Linux系统中升级gcc版本,以便更好地支持C++11及以上版本的新特性。通过升级gcc,可以提升编译器的功能和性能,获得更好的开发体验。详细的步骤和方法请参考原文链接。
文章浏览阅读4.4k次,点赞6次,收藏19次。Mosquitto是一个开源的MQTT消息代理服务器。MQTT是一个轻量级的、基于发布/订阅模式的消息传输协议。 mosquitto的安装使用比较简单,可以方便的来进行一些测试。_linux mosquitto
文章浏览阅读7.2k次,点赞2次,收藏12次。Linux中,用于根目录下有一个.ssh目录,保存了ssh相关的key和一些记录文件。_~/.ssh/
文章浏览阅读4.5k次,点赞5次,收藏18次。首先需要安装 snmp ,使用下面的命令进行安装安装完毕之后,使用下面的命令查看是否安装成功当命令行显示如图即为安装成功。_snmp工具
文章浏览阅读3.5k次,点赞7次,收藏24次。本地部署和使用llama.cpp进行量化Llama2,linux和Windows平台方案,支持CPU和GPU多版本。_llama cpp gpu
文章浏览阅读1.4k次,点赞46次,收藏44次。在vim中,最为常见的有三种模式,分别是:命令模式(command mode)、插 入模式(Insert mode)和底行模式(last line mode)文件保存或退出,也可以进行文件替换,找字符串,列出行号等操作。在命令模式下,shift+: 即可进入该模 式。在进入vim后,使用 i 进入插入模式,插入模式就是vim的编辑模式,可以在vim中进行内容的编辑和修改。vim的核心模式,使用vim进入文件编辑时的最初模式,在该模式中只能移动光标和使用命令对文件内容进行编辑。
Linux常用命令大全,包括目录操作命令和文件操作命令,以及查看登录用户命令和文件内容查看命令等。
文章浏览阅读1.7k次,点赞57次,收藏50次。Yearning 简单, 高效的MYSQL 审计平台 一款MYSQL SQL语句/查询审计工具,为DBA与开发人员使用.本地部署,注重隐私,简单高效的MYSQL审计平台。下面介绍Linux 简单部署Yearning 并结合cpolar 内网穿透工具实现远程访问,破除访问限制,提高工作效率!!
文章浏览阅读1.9w次,点赞7次,收藏18次。Microsoft Edge是一款现代化的浏览器,它拥有众多功能和强大的性能,为用户带来更加流畅的浏览体验。Edge最近推出了分屏功能,支持一个窗口同时显示两个选项卡,这可以大大提高生产力和多任务处理能力。欢迎大家使用分屏及其他新功能后分享自己的使用心得与建议。首先,使用Microsoft Edge的分屏功能确实能够提高生产力,尤其是在需要同时浏览两个不同网页的情况下。分屏功能使得在一个窗口中同时显示两个选项卡,用户可以在两个网页之间快速切换,而无需打开新的窗口或使用多个浏览器窗口。_edge linux
文章浏览阅读1.8k次,点赞83次,收藏71次。C语言实现倒计时和进度条并进行演示。_linux不换行输出倒计时
文章浏览阅读1.5k次,点赞28次,收藏25次。基于嘉立创泰山派开发板,本机使用VMware+Unbuntu,编译泰山派的Linux SDK。详细教程,0基础小白可操作!内涵大量基础操作和linux基本知识。_立创泰山派sdk编译