当 SSH 客户端尝试连接 CentOS 7 时,openssh-server 会等待密码提示,但始终没有出现。当我调试时,连接日志和 netstat 显示连接已建立。
这是我的客户端调试:
tevfik@Darktower:~$ ssh -vvv [email protected]
OpenSSH_8.2p1 Ubuntu-4ubuntu0.3, OpenSSL 1.1.1f 31 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug3: kex names ok: [diffie-hellman-group1-sha1,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1]
debug2: resolve_canonicalize: hostname 10.40.4.19 is address
debug2: ssh_connect_direct
debug1: Connecting to 10.40.4.19 [10.40.4.19] port 22.
debug1: Connection established.
debug1: identity file /home/tevfik/.ssh/id_rsa type -1
debug1: identity file /home/tevfik/.ssh/id_rsa-cert type -1
debug1: identity file /home/tevfik/.ssh/id_dsa type -1
debug1: identity file /home/tevfik/.ssh/id_dsa-cert type -1
debug1: identity file /home/tevfik/.ssh/id_ecdsa type -1
debug1: identity file /home/tevfik/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/tevfik/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/tevfik/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/tevfik/.ssh/id_ed25519 type -1
debug1: identity file /home/tevfik/.ssh/id_ed25519-cert type -1
debug1: identity file /home/tevfik/.ssh/id_ed25519_sk type -1
debug1: identity file /home/tevfik/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/tevfik/.ssh/id_xmss type -1
debug1: identity file /home/tevfik/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.3
你知道吗?问候,
答案1
假设您可以本地访问服务器端,您可以停止服务器上的 sshd 服务,然后以详细模式运行 sshd 服务以查看登录时发生的情况。对于 sshd 服务,详细模式(调试模式)为 -d 或最高为 -ddd。
https://linux.die.net/man/8/sshd
https://unix.stackexchange.com/a/55481
另一件需要检查的事情是服务器是否配置为允许密码 ssh 访问。这是 sshd_config 文件中的 PasswordAuthentication 选项。
https://linux.die.net/man/5/sshd_config
检查安全和身份验证日志中的身份验证问题:
https://superuser.com/a/1293901/1178349
检查 SELinux 问题: