V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
cnbattle
V2EX  ›  Linux

运维大牛来看看, Linux 服务器宽带一直被占满

  •  
  •   cnbattle ·
    cnbattle · 2018-07-01 11:08:00 +08:00 · 3817 次点击
    这是一个创建于 2097 天前的主题,其中的信息可能已经有所发展或是发生改变。

    最近服务器宽带一直被跑满,用 nethogs 查询如下,都是 ssh 占用的,请问下是大概是什么原因?被黑了吗?

    重启后,宽带占用会慢慢跑到满

    NetHogs version 0.8.5                                                                       
                                                                                              
        PID USER     PROGRAM                                  DEV        SENT      RECEIVED     
       9480 root     ssh                                      eth0        8.704       4.451 KB  
      11599 root     ssh                                      eth0        7.364       3.988 KB  
        358 root     ssh                                      eth0        7.644       3.748 KB  
      30810 root     ssh                                      eth0        9.798       3.611 KB  
       2598 root     ssh                                      eth0        8.431       3.230 KB  
       2572 root     ssh                                      eth0        9.874       3.230 KB  
      31839 root     ssh                                      eth0        8.431       3.230 KB  
      12350 root     ssh                                      eth0        8.703       3.170 KB  
       6843 root     ssh                                      eth0        6.629       3.158 KB  
       4896 root     ssh                                      eth0        8.472       3.104 KB  
      32713 root     ssh                                      eth0       10.140       3.104 KB  
       6748 root     ssh                                      eth0        7.416       3.002 KB  
       1309 root     ssh                                      eth0        6.411       2.926 KB  
       9289 root     ssh                                      eth0        7.015       2.924 KB  
      14902 root     ssh                                      eth0        6.661       2.100 KB  
       6748 root     ssh                                      eth0        7.416       3.002 KB  
      15564 root     ssh                                      eth0        6.493       2.947 KB  
      12309 root     ssh                                      eth0        6.411       2.826 KB  
       9289 root     ssh                                      eth0        7.015       2.824 KB  
       1676 root     ssh                                      eth0       15.860       2.867 KB  
       1580 root     ssh                                      eth0        7.981       2.900 KB  
      31935 root     ssh                                      eth0        6.515       2.900 KB  
      11618 root     ssh                                      eth0        8.453       2.891 KB  
      32289 root     ssh                                      eth0        8.063       2.883 KB  
      12399 root     ssh                                      eth0       10.033       2.847 KB  
       7625 root     ssh                                      eth0        7.694       2.865 KB  
      11565 root     ssh                                      eth0        6.490       2.863 KB  
      11422 root     ssh                                      eth0        5.853       2.850 KB  
       8332 root     ssh                                      eth0        8.011       2.850 KB  
       1419 root     ssh                                      eth0        8.686       2.742 KB  
      10507 root     ssh                                      eth0        3.827       2.777 KB  
       6771 root     ssh                                      eth0        6.700       2.778 KB  
      32108 root     ssh                                      eth0        5.878       2.838 KB  
      13732 root     ssh                                      eth0        5.099       2.834 KB  
      14496 root     ssh                                      eth0        8.185       2.787 KB  
       9219 root     ssh                                      eth0        9.316       2.777 KB  
       6346 root     ssh                                      eth0        7.312       2.777 KB  
      10847 root     ssh                                      eth0        9.438       2.773 KB  
       8793 root     ssh                                      eth0        7.394       2.773 KB  
      32048 root     ssh                                      eth0        6.334       2.766 KB  
       4570 root     ssh                                      eth0        6.177       2.762 KB  
       3766 root     ssh                                      eth0        5.550       2.762 KB  
      32106 root     ssh                                      eth0        4.499       2.662 KB  
      13363 root     ssh                                      eth0        3.011       2.623 KB  
       1268 root     ssh                                      eth0        9.164       2.623 KB  
      14645 root     ssh                                      eth0        8.555       2.713 KB  
      13679 root     ssh                                      eth0        8.472       2.711 KB  
      TO081                                                            4839.906    1024.711 KB  
    
    11 条回复    2018-07-06 12:03:42 +08:00
    jpmorn
        1
    jpmorn  
       2018-07-01 11:14:03 +08:00
    tcpdump -i eth0 -s 100 -w aaa.pcap 抓个包看看。
    a7a2
        2
    a7a2  
       2018-07-01 11:14:52 +08:00
    查看一下所有用户账号,看看有无非你添加的账号

    修改 ssh 端口,限制 ssh 只能在某些 ip 段登陆

    你服务器可能被用 ssh 上网了
    flynaj
        3
    flynaj  
       2018-07-01 11:15:29 +08:00 via Android
    ssh 改端口,密码,基本上是被黑了
    anubu
        4
    anubu  
       2018-07-01 11:19:39 +08:00   ❤️ 1
    只是名字叫 ssh,实际上可能并不是,或者被替换了。查一下这个进程的具体可执行文件是什么吧。
    ryd994
        5
    ryd994  
       2018-07-01 11:20:37 +08:00 via Android
    莫不是免费 ssh 代理(笑
    cnbattle
        6
    cnbattle  
    OP
       2018-07-01 11:32:24 +08:00   ❤️ 1
    @jpmorn
    @a7a2
    @flynaj
    @anubu
    @ryd994
    谢谢各位,我的问题,crontab 里 加了一条 死循环的 shell (捂脸
    opengps
        7
    opengps  
       2018-07-01 22:04:59 +08:00 via Android
    楼主 6 楼有答案了,不过我还是借题说下我的第一感觉,是远程端口被爆破中,6 楼题主说的应该也是类似于自己在爆破的效果
    yjd
        8
    yjd  
       2018-07-02 08:51:29 +08:00 via Android
    被做成代理了。
    ReinWD
        9
    ReinWD  
       2018-07-02 13:40:36 +08:00
    考虑关闭 ssh 的密码登录 使用 ssh 密钥对登录方便安全

    可以考虑在自己手机上安装个 ssh 应用 这样即使需要用到他人机子 用 ssh-keygen 生成个密钥传给手机然后手机上传服务器,只要带了手机就不怕登录不了服务器

    非自己机子登录服务器之后记得走前把密钥删掉
    cstj0505
        10
    cstj0505  
       2018-07-02 16:41:54 +08:00
    哈哈,看笑了
    lcdxiangzi
        11
    lcdxiangzi  
       2018-07-06 12:03:42 +08:00
    @cnbattle 早上想改自己的 crontab,就是担心类似的问题,决定先不动了。O(∩_∩)O~
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3103 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 12:55 · PVG 20:55 · LAX 05:55 · JFK 08:55
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.