AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 25420
Accepted
racbear
racbear
Asked: 2009-06-14 22:06:10 +0800 CST2009-06-14 22:06:10 +0800 CST 2009-06-14 22:06:10 +0800 CST

每分钟都有奇怪的 sshd 日志消息

  • 772

我的 linux 机器每分钟都会在 /var/log/secure 中收到此错误消息

Jun 14 04:24:28 mybox sshd[19741]: Connection closed by 127.0.0.1
Jun 14 04:25:28 mybox sshd[19764]: Connection closed by 127.0.0.1
Jun 14 04:26:28 mybox sshd[19770]: Connection closed by 127.0.0.1
Jun 14 04:27:28 mybox sshd[19776]: Connection closed by 127.0.0.1
Jun 14 04:28:28 mybox sshd[19782]: Connection closed by 127.0.0.1
Jun 14 04:29:28 mybox sshd[19789]: Connection closed by 127.0.0.1

它是带有 OpenSSH_4.3p2 的 centos 5.2 x86_64,sshd 端口未设置为默认端口,我使用了不同的端口,我认为这是一些糟糕的程序从内部(lo)做了一些蛮力 ssh 攻击。我曾尝试将 sshd: 127.0.0.1 放入 /etc/hosts.deny,然后消息现在改变了,

Jun 14 12:45:54 mybox sshd[25736]: refused connect from ::ffff:127.0.0.1 (::ffff:127.0.0.1)
Jun 14 12:45:59 mybox sshd[25701]: Received signal 15; terminating.
Jun 14 12:46:00 mybox sshd[25761]: Server listening on :: port 5522.
Jun 14 12:46:00 mybox sshd[25761]: error: Bind to port 5522 on 0.0.0.0 failed: Address already in use.
Jun 14 12:47:01 mybox sshd[25767]: refused connect from ::ffff:127.0.0.1 (::ffff:127.0.0.1)
Jun 14 12:47:06 mybox sshd[25761]: Received signal 15; terminating.
Jun 14 12:47:07 mybox sshd[25792]: Server listening on :: port 5522.
Jun 14 12:47:07 mybox sshd[25792]: error: Bind to port 5522 on 0.0.0.0 failed: Address already in use.
Jun 14 12:54:19 mybox sshd[25881]: error: Bind to port 5522 on 0.0.0.0 failed: Address already in use.
Jun 14 12:54:19 mybox sshd[25881]: fatal: Cannot bind any address.

以前有人遇到过这个问题吗?我该如何分析这些东西..

centos ssh
  • 4 4 个回答
  • 8186 Views

4 个回答

  • Voted
  1. Joe
    2009-06-14T22:23:58+08:002009-06-14T22:23:58+08:00

    您是否有某种系统监控工具(monit/collectd)可以检查您的 ssh 服务器是否处于活动状态并接受连接?

    • 4
  2. Dave Cheney
    2009-06-14T22:40:58+08:002009-06-14T22:40:58+08:00
    Jun 14 12:46:00 mybox sshd[25761]: Server listening on :: port 5522.
    Jun 14 12:46:00 mybox sshd[25761]: error: Bind to port 5522 on 0.0.0.0 failed: Address already in use.
    

    我认为启动您的任何脚本都sshd无法检测到它正在运行并重复重新启动它的进程。

    • 1
  3. Best Answer
    Avery Payne
    2009-06-15T01:30:12+08:002009-06-15T01:30:12+08:00

    这里的关键是“地址已在使用中”。另一个进程已经绑定到该端口。您是否尝试运行该服务的两个实例?有时,控制脚本会失去理智(不是真的,发生的情况是 pid 文件被删除而不是进程被删除)并且他们会在服务已经运行时尝试启动服务。首先,停止服务一次,看看是否出现消息。

    service sshd stop
    

    然后检查一下周围是否已经有一个sshd ...

    ps ax | grep "ssh" | grep -v "grep"
    

    如果您在服务停止后看到一个,那就是问题的原因。杀死它,然后重新启动服务

    service sshd start
    

    PS 是的,我知道我的 shell 脚本很烂,但有时清晰比简洁要快。

    • 0
  4. Brent
    2009-06-15T05:29:49+08:002009-06-15T05:29:49+08:00

    连接显然来自本地机器 (127.0.0.1) - 所以你不必看得很远。

    并且日志消息是由 sshd 生成的(所以 sshd 正在检测尝试的连接)——所以你知道无论是什么进程导致了这些,要么它知道非标准端口,要么你有第二个 sshd 实例在运行标准端口(使用 netstat 检查)。

    您可以暂时删除 hosts.deny 条目,然后使用 lsof 确定哪个进程正在尝试访问您的非标准 sshd 端口(lsof -i : port)?

    如果什么都没有出现,我会使用 chkrootkit 或 rkhunter 来确保您的系统没有受到威胁。

    • 0

相关问题

  • Mac OS X:如何在无头机器上运行 GUI 应用程序

  • Windows SSH 客户端

  • 在 Windows Server 2003 上通过 SSH 启动和停止 Mongrel 服务

  • 隧道 Xbox 网络流量 [关闭]

  • 为什么使用authorized_keys通过ssh自动登录不起作用?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    从 IP 地址解析主机名

    • 8 个回答
  • Marko Smith

    如何按大小对 du -h 输出进行排序

    • 30 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    Windows 中执行反向 DNS 查找的命令行实用程序是什么?

    • 14 个回答
  • Marko Smith

    如何检查 Windows 机器上的端口是否被阻塞?

    • 4 个回答
  • Marko Smith

    我应该打开哪个端口以允许远程桌面?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    MikeN 在 Nginx 中,如何在维护子域的同时将所有 http 请求重写为 https? 2009-09-22 06:04:43 +0800 CST
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    0x89 bash中的双方括号和单方括号有什么区别? 2009-08-10 13:11:51 +0800 CST
  • Martin Hope
    kch 如何更改我的私钥密码? 2009-08-06 21:37:57 +0800 CST
  • Martin Hope
    Kyle Brandt IPv4 子网如何工作? 2009-08-05 06:05:31 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve