Common commands and ideas for Linux emergency response

Source: Internet
Author: User

1, first check the network connection situation:

1#netstat-anop |grep "SSH" /*view SSH connection or telent*/2#netstat-anop |grep "a.b.c.d" /*to view connected IPs*/3#PSAux/*View can process*/ 4 /*5 can be combined because there's PID in the Netstat-anop .6 */

The above confirms whether the attacker is still connected. If connected, it is recommended to shut down the network or direct offline emergency.

2. View history

1 /* View history Commands */= "Even if an attacker strikes unset history, it will be recorded at least

If you feel that history is too small, see the history command file:

1 #vim ~/.bash_history

3. View Users:

1 #who/        * View login */2 #WhoAmI/   *  See who you are * *3 #vim/etc/passwd4 #vim/etc/shadow

4. View recently changed documents:

1 #Find /path/-mtime-1 -type F-print2 #Find /path/-ctime-1 -type F-print3 #ls -alt

5. View all script file packages:

1 find /var/www/html/  |  grep""| Xargs tar zcvf/tmp/shellscript. tar. gz

6. View Web logs:

1 /*Access_log:/var/log/httpd/access_log*/2#CatAccess_log |awk '{print $}'|Sort|Uniq-c View the IP access3#CatAccess_log |awk '{print $}'|Sort|Uniq-c|Sort-n-t' 'sort by number of visits4#Find./-name"*.php"|grep 404|Xargs ls-la//(Xargs) upload the previous results to the back as input5/*awk Specify symbol Cut:-F ' cut symbol '6#Find/var/www/html/-name"*.php"|Xargs grepChenran viewing the contents of a file

Common commands and ideas for Linux emergency response

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.