1. 程式人生 > >雲主機被挖礦的應急腳本

雲主機被挖礦的應急腳本

res eth done kill -9 capture ogre The true ogr

  當雲主機被挖礦之後,一般都不能很快清除挖礦程序,而這時你的雲主機cpu占用率會一直居高不下,為避免主機被鎖定可先用這個腳本殺死挖礦程序,然後再來慢慢排查問題。

腳本內容:

#!/bin/bash

# This script is used to kill progress which having abnormal occupancy rate of CPU,

# I want through this way to protect my server from the hacker who attempting to use my server to mining.

# The method is capture PID which progress‘ occupancy rate of CPU greater than 90% by awk,then kill these PID.

while true;do

for i in `ps aux | awk ‘{if($3 > 90){print $2}}‘`;do

kill -9 $i

done

done

雲主機被挖礦的應急腳本