从 Bullseye 升级到 Bookworm 后,我无法通过 SSH 连接到我的 Debian 服务器。我尝试了各种故障排除步骤,但问题仍然存在。
错误信息:
Last login: Wed Apr 10 13:42:16 2024 from 192.168.x.x
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
/usr/bin/sh: Permission denied
采取的故障排除步骤:
sshd
从机器中清除并重新安装openssh-server
。- 将 设为
sshd_config
完全空白的配置,仅使用默认值。 - 尝试使用 SSH 在本地连接到服务器
ssh user@localhost
,但遇到了相同的错误。 - 尝试了不同的默认 shell(例如,
/usr/bin/bash
),但收到类似的“权限被拒绝”错误。 - 尝试以不同用户(包括 root)身份登录,但问题仍然存在。
- 已验证
/etc/shells
包含正确的 shell 路径(/usr/bin/bash
、/usr/bin/sh
等)。 - 检查了主目录和
.ssh
目录的权限,看起来都正常。 - 删除了
authorized_keys
文件以排除基于密钥的身份验证的任何问题。
附加信息:
- 当我以 root 和普通用户身份本地访问服务器时,都可以成功登录。
- 该
/var/log/auth.log
文件显示“已接受...的密码”,后跟“已收到...的断开连接:用户已断开连接”。
系统详细信息:
- Debian 版本:Bookworm(从 Bullseye 升级)
- OpenSSH 服务器版本:OpenSSH_9.2p1 Debian-2+deb12u2、OpenSSL 3.0.11 2023 年 9 月 19 日
setatus 给出: SELinux 状态:已禁用
我已经用尽了我的故障排除想法,并且非常感谢有关如何解决此 SSH 登录问题的任何见解或建议。如果您需要任何进一步的信息,请告诉我。