Hi.baidu.com/p3rlishthe fixed-period checklist specifies that the number of accounts with the specified user ID is 0, which is a major task of the system administrator! However, checking at any time is impractical! Let the system do the work! 1. edit/usr/local/bin/checkhacker and write :#! /Bin/bashforidinawkFS
Hi.baidu.com/p3rlish
It is an important task for the system administrator to regularly check for accounts with a user ID equal to 0 in the password file! However, checking at any time is impractical! Let the system do the work!
1. edit/usr/local/bin/checkhacker and write:
#! /Bin/bash
For id in awk FS = ":" {if ($3 = 0 & $1! = "Root") print $1}/etc/passwd
Do
Mail-s "Hacker Alert" root @ localhost <eof
**********************************
*
* ALERT! Login ID echo $ {id} has uid 0
* Date "+ Detacted On: % D Time: % r"
**********************************
EOF
Done
2. chmod + x checkhacker for execution:
3. add the following to/etc/crontab:
15 ***/usr/local/bin/checkhacker/dev/null 2> & 1
In this way, the system automatically checks every 15 minutes and sends a MAIL to the system administrator as soon as possible!