Linux 服务器拒绝连接

Linux 服务器拒绝连接

在尝试运行 Pentaho Job 时失败,提示“使用用户名 [pentaho] 打开与 [localhost] 的连接时出错!”并附加注释“使用用户名 [pentaho] 的身份验证失败!”。

该作业尝试执行的所有操作是并行运行多个连接并执行一些 Linux 命令。由于某些奇怪的原因(我不知道),该作业在超过一定数量的连接后被终止(有些成功,有些失败)。

sshd_config大部分都采用默认设置,并PasswordAuthentication设置为yes

uname -aLinux pentahoserver 2.6.32-573.1.1.el6.x86_64 #1 SMP Tue Jul 14 02:46:51 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux

内容/var/log/secure

Jan 31 17:14:24 pentahoserver sshd[22593]: pam_tally2(sshd:auth): user pentaho (1000) tally 7, deny 6
Jan 31 17:14:24 pentahoserver sshd[22593]: pam_tally2(sshd:auth): user pentaho (1000) tally 8, deny 6
Jan 31 17:14:24 pentahoserver sshd[22582]: Accepted password for pentaho from 127.0.0.1 port 42522 ssh2
Jan 31 17:14:24 pentahoserver sshd[22521]: Accepted password for pentaho from 127.0.0.1 port 42517 ssh2
Jan 31 17:14:24 pentahoserver sshd[22516]: Accepted password for pentaho from 127.0.0.1 port 42515 ssh2
Jan 31 17:14:24 pentahoserver sshd[22582]: pam_unix(sshd:session): session opened for user pentaho by (uid=0)
Jan 31 17:14:24 pentahoserver sshd[22521]: pam_unix(sshd:session): session opened for user pentaho by (uid=0)
Jan 31 17:14:24 pentahoserver sshd[22516]: pam_unix(sshd:session): session opened for user pentaho by (uid=0)
Jan 31 17:14:24 pentahoserver sshd[22788]: Received disconnect from 127.0.0.1: 11: Closed due to user request.
Jan 31 17:14:24 pentahoserver sshd[22786]: Received disconnect from 127.0.0.1: 11: Closed due to user request.
Jan 31 17:14:24 pentahoserver sshd[22516]: pam_unix(sshd:session): session closed for user pentaho
Jan 31 17:14:24 pentahoserver sshd[22521]: pam_unix(sshd:session): session closed for user pentaho
Jan 31 17:14:24 pentahoserver sshd[22866]: Accepted password for pentaho from 127.0.0.1 port 42545 ssh2
Jan 31 17:14:24 pentahoserver sshd[22841]: Accepted password for pentaho from 127.0.0.1 port 42544 ssh2
Jan 31 17:14:24 pentahoserver sshd[22866]: pam_unix(sshd:session): session opened for user pentaho by (uid=0)
Jan 31 17:14:24 pentahoserver sshd[22841]: pam_unix(sshd:session): session opened for user pentaho by (uid=0)
Jan 31 17:14:25 pentahoserver sshd[23037]: Accepted password for pentaho from 127.0.0.1 port 42562 ssh2
Jan 31 17:14:25 pentahoserver sshd[23032]: Accepted password for pentaho from 127.0.0.1 port 42560 ssh2
Jan 31 17:14:25 pentahoserver sshd[23185]: Received disconnect from 127.0.0.1: 11: Closed due to user request.
Jan 31 17:14:25 pentahoserver sshd[22866]: pam_unix(sshd:session): session closed for user pentaho
Jan 31 17:14:25 pentahoserver sshd[23339]: pam_tally2(sshd:auth): user pentaho (1000) tally 7, deny 6
Jan 31 17:14:25 pentahoserver sshd[23117]: pam_tally2(sshd:auth): user pentaho (1000) tally 8, deny 6
Jan 31 17:14:25 pentahoserver sshd[23336]: pam_tally2(sshd:auth): user pentaho (1000) tally 7, deny 6
Jan 31 17:14:25 pentahoserver sshd[23186]: Received disconnect from 127.0.0.1: 11: Closed due to user request.
Jan 31 17:14:25 pentahoserver sshd[23339]: pam_tally2(sshd:auth): user pentaho (1000) tally 8, deny 6
Jan 31 17:14:25 pentahoserver sshd[23338]: pam_tally2(sshd:auth): user pentaho (1000) tally 9, deny 6
Jan 31 17:14:25 pentahoserver sshd[23117]: pam_tally2(sshd:auth): user pentaho (1000) tally 9, deny 6
Jan 31 17:14:25 pentahoserver sshd[23336]: pam_tally2(sshd:auth): user pentaho (1000) tally 10, deny 6
Jan 31 17:14:25 pentahoserver sshd[22841]: pam_unix(sshd:session): session closed for user pentaho
Jan 31 17:14:25 pentahoserver sshd[23178]: Accepted password for pentaho from 127.0.0.1 port 42570 ssh2
Jan 31 17:14:25 pentahoserver sshd[23111]: Accepted password for pentaho from 127.0.0.1 port 42566 ssh2
Jan 31 17:14:25 pentahoserver sshd[23190]: Accepted password for pentaho from 127.0.0.1 port 42571 ssh2
Jan 31 17:14:25 pentahoserver sshd[23337]: Accepted password for pentaho from 127.0.0.1 port 42573 ssh2
Jan 31 17:14:25 pentahoserver sshd[23037]: pam_unix(sshd:session): session opened for user pentaho by (uid=0)
Jan 31 17:14:25 pentahoserver sshd[23032]: pam_unix(sshd:session): session opened for user pentaho by (uid=0)
Jan 31 17:14:25 pentahoserver sshd[23429]: Accepted password for pentaho from 127.0.0.1 port 42583 ssh2
Jan 31 17:14:25 pentahoserver sshd[23190]: pam_unix(sshd:session): session opened for user pentaho by (uid=0)
Jan 31 17:14:25 pentahoserver sshd[23111]: pam_unix(sshd:session): session opened for user pentaho by (uid=0)
Jan 31 17:14:25 pentahoserver sshd[23178]: pam_unix(sshd:session): session opened for user pentaho by (uid=0)
Jan 31 17:14:25 pentahoserver sshd[23337]: pam_unix(sshd:session): session opened for user pentaho by (uid=0)
Jan 31 17:14:25 pentahoserver sshd[23562]: Received disconnect from 127.0.0.1: 11: Closed due to user request.
Jan 31 17:14:25 pentahoserver sshd[23547]: Received disconnect from 127.0.0.1: 11: Closed due to user request.
Jan 31 17:14:25 pentahoserver sshd[23037]: pam_unix(sshd:session): session closed for user pentaho
Jan 31 17:14:25 pentahoserver sshd[23032]: pam_unix(sshd:session): session closed for user pentaho
Jan 31 17:14:25 pentahoserver sshd[23429]: pam_unix(sshd:session): session opened for user pentaho by (uid=0)
Jan 31 17:14:25 pentahoserver sshd[23530]: Accepted password for pentaho from 127.0.0.1 port 42588 ssh2
Jan 31 17:14:25 pentahoserver sshd[23542]: Accepted password for pentaho from 127.0.0.1 port 42589 ssh2
Jan 31 17:14:25 pentahoserver sshd[23530]: pam_unix(sshd:session): session opened for user pentaho by (uid=0)
Jan 31 17:14:25 pentahoserver sshd[23542]: pam_unix(sshd:session): session opened for user pentaho by (uid=0)
Jan 31 17:14:25 pentahoserver sshd[23612]: Received disconnect from 127.0.0.1: 11: Closed due to user request.
Jan 31 17:14:25 pentahoserver sshd[23624]: Received disconnect from 127.0.0.1: 11: Closed due to user request.
Jan 31 17:14:25 pentahoserver sshd[23178]: pam_unix(sshd:session): session closed for user pentaho
Jan 31 17:14:25 pentahoserver sshd[23190]: pam_unix(sshd:session): session closed for user pentaho
Jan 31 17:14:25 pentahoserver sshd[23785]: Received disconnect from 127.0.0.1: 11: Closed due to user request.
Jan 31 17:14:25 pentahoserver sshd[23542]: pam_unix(sshd:session): session closed for user pentaho
Jan 31 17:14:25 pentahoserver sshd[23786]: Received disconnect from 127.0.0.1: 11: Closed due to user request.
Jan 31 17:14:25 pentahoserver sshd[23530]: pam_unix(sshd:session): session closed for user pentaho
Jan 31 17:14:26 pentahoserver sshd[22593]: Failed password for pentaho from 127.0.0.1 port 42523 ssh2
Jan 31 17:14:26 pentahoserver sshd[22599]: Received disconnect from 127.0.0.1: 11: Closed due to user request.
Jan 31 17:14:27 pentahoserver sshd[23117]: Failed password for pentaho from 127.0.0.1 port 42567 ssh2
Jan 31 17:14:27 pentahoserver sshd[23137]: Received disconnect from 127.0.0.1: 11: Closed due to user request.
Jan 31 17:14:27 pentahoserver sshd[23338]: Failed password for pentaho from 127.0.0.1 port 42576 ssh2
Jan 31 17:14:27 pentahoserver sshd[23348]: Received disconnect from 127.0.0.1: 11: Closed due to user request.
Jan 31 17:14:27 pentahoserver sshd[23339]: Failed password for pentaho from 127.0.0.1 port 42577 ssh2
Jan 31 17:14:27 pentahoserver sshd[23351]: Received disconnect from 127.0.0.1: 11: Closed due to user request.
Jan 31 17:14:27 pentahoserver sshd[23336]: Failed password for pentaho from 127.0.0.1 port 42572 ssh2
Jan 31 17:14:27 pentahoserver sshd[23345]: Received disconnect from 127.0.0.1: 11: Closed due to user request.

有人可以帮忙吗?

答案1

虽然这不是您所提出的问题的直接答案,但使用下面描述的方法可以首先防止您遇到此类问题。

我认为在运行自动作业时使用私钥认证是一种更好的做法。

为此,您需要在每台您打算 ssh 连接的机器上以及运行命令的服务器(我们称之为管理服务器)中生成一个 rsa ssh 密钥,然后在管理服务器和 ssh 客户端机器之间交换密钥。

这将允许您从管理服务器 ssh 到 ssh 客户端服务器而无需输入密码。

除了 ssh 密钥交换之外,我建议你检查一下这个脚本我编写的它包装了“pssh”(并行 ssh)命令并使您能够为该命令提供一个 server.list 文件和一个命令,然后脚本将在列表中的每个服务器上运行该命令,并且会为您提供一些彩色指示以指示在每个服务器上运行该命令的结果。

使用该脚本需要您安装 pssh(也称为 parallel-ssh)。

如果您不确定应该采取哪些步骤,请告诉我,我会帮助您执行命令。

相关内容