Wol*_*mec 75 ssh authentication logs
我们有一个 Windows 批处理脚本,它通过 PLINK(腻子)自动连接到 linux 服务器。没有公私钥认证,用户和密码在脚本中。
在我们的 linux 服务器上,我们有几个 sshd 日志条目(/var/log/messages):
sshd[7645]: Connection closed by xxx [preauth]
Run Code Online (Sandbox Code Playgroud)
出现这种消息的原因可能是什么?
“preauth”应该是“预认证”的意思吗?
有时在条目中,“关闭者”中有windows客户端的ip地址,另一种时候在“关闭者”中有linux服务器的ip地址。有人知道消息中客户端IP地址和主机IP地址的区别吗?
小智 30
该sshd
服务器将断开如果客户端不会尝试在一定时间内进行身份验证,如记录-g
选项。
-g login_grace_time
Gives the grace time for clients to authenticate themselves
(default 120 seconds). If the client fails to authenticate
the user within this many seconds, the server disconnects
and exits. A value of zero indicates no limit.
Run Code Online (Sandbox Code Playgroud)
因此,我怀疑如果您在带有此消息的日志中看到服务器 IP,则连接已关闭,因为在此宽限期内未发生身份验证尝试。当您看到客户端 IP 时,这意味着用户在没有进行身份验证尝试的情况下关闭了他们的客户端(或脚本终止)。
小智 14
就我而言,当我Host key verification failed.
在 ssh 客户端遇到错误时,这些消息出现在 /var/log/secure 中。这是在没有登录尝试的情况下会导致连接的情况之一。
小智 10
我有同样的问题,我是这样解决的:
在 ssh 服务器上,我取消注释,并将以下值放在/etc/ssh/sshd_config中
RSAAuthentication yes
PubkeyAuthentication yes
Run Code Online (Sandbox Code Playgroud)
进而:
sudo service sshd restart
Run Code Online (Sandbox Code Playgroud)
小智 6
我遇到了与您非常相似的问题(尽管我使用的是公钥)。
结果证明我的问题,也可能是你的问题,是因为我的主目录是 NFS 挂载,而 selinux(在 CentOS 7 上)抛出了一些错误(很难追踪)。修复很简单。
setsebool -P use_nfs_home_dirs 1
Run Code Online (Sandbox Code Playgroud)
使用过时的 SSH 服务器和更新的 SSH 客户端时可能会遇到此问题。
我们使用以下方法解决了这个问题
ssh-keygen -t ed25519 -C“your_email@example.com”
生成新的 SSH 密钥。
将以下内容添加到/etc/ssh/ssh_config
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa
Run Code Online (Sandbox Code Playgroud)