一次服务器被***
今天早上一来就收到nagios一堆报警邮件,并且都是critical,某台机器的磁盘空间不足,细细查看发现
早4点-12点(服务器在美国,因此是美国时间),72G的根分区使用率由40%忽然增长到100%.到满了之后就中止了.
首先将nagios对这个服务的邮件提醒暂时停掉,而后登录到服务器查看.
这么快这么大数据量的增加,怀疑是产生了很巨大的文件.先是按大小查大于1g的文件
find / -size +1000000000c
查出来就一个文件,上次修改依旧是好久之前了,大小也就2G而已,显然不对
继续查找一天以内被修改的文件 find / -mtime -1 >log (因为查找结果实在太多,因此将输出重定向到log文件里面)
将这个log下载下来查看,下面的内容引发了个人注意
/home/xxx/.ssh/.io
/home/xxx/.ssh/.io/Hostel.Part.II.2007.NTSC.DVDR-CuriousJotos
/home/xxx/.ssh/.io/Hostel.Part.II.2007.NTSC.DVDR-CuriousJotos/cj-hostel2-dvdr.sfv
/home/xxx/.ssh/.io/Hostel.Part.II.2007.NTSC.DVDR-CuriousJotos/cj-hostel2-dvdr.nfo
/home/xxx/.ssh/.io/Hostel.Part.II.2007.NTSC.DVDR-CuriousJotos/Sample
/home/xxx/.ssh/.io/Hostel.Part.II.2007.NTSC.DVDR-CuriousJotos/Sample/cj-hostel2-dvdr-sample.vob
/home/xxx/.ssh/.io/Hostel.Part.II.2007.NTSC.DVDR-CuriousJotos/cj-hostel2-dvdr.r46
/home/xxx/.ssh/.io/Hostel.Part.II.2007.NTSC.DVDR-CuriousJotos/cj-hostel2-dvdr.r91
/home/xxx/.ssh/.io/Hostel.Part.II.2007.NTSC.DVDR-CuriousJotos/cj-hostel2-dvdr.r59
/home/xxx/.ssh/.io/Hostel.Part.II.2007.NTSC.DVDR-CuriousJotos/cj-hostel2-dvdr.r43
/home/xxx/.ssh/.io/Hostel.Part.II.2007.NTSC.DVDR-CuriousJotos/cj-hostel2-dvdr.r28
/home/xxx/.ssh/.io/Hostel.Part.II.2007.NTSC.DVDR-CuriousJotos/cj-hostel2-dvdr.rar
/home/xxx/.ssh/.io/Hostel.Part.II.2007.NTSC.DVDR-CuriousJotos/cj-hostel2-dvdr.r90
/home/xxx/.ssh/.io/Hostel.Part.II.2007.NTSC.DVDR-CuriousJotos/cj-hostel2-dvdr.r03
/home/xxx/.ssh/.io/Hostel.Part.II.2007.NTSC.DVDR-CuriousJotos/cj-hostel2-dvdr.r02
..
DVD !!!并且还有好几部
到这个目录下面去查看一下目录的大小
du –h
好家伙36G,事发以前,被修改的文件总共也就300M,其他的都是事发当天修改的
并且文件的全部者和组都是xxx,很显然是xxx帐户在做怪!
问了一下才知道是好久好久之前离职的一我的,当时没人删这个账号,没想到如今被利用了
接下来就是删除这个帐户了
发生相似的事情特别要注意:可疑用户,隐藏文件,经过last查看登录的用户,固然还有日志