这是一个用于SSH的脚本,当用户从远程登陆时,如果用户输入的不是你想要的邮件地址,那么他将被你T出去你的服务器。
#!/bin/bash
#this script will kill you!

for i in `(w | grep pts | grep -v :0.0 | awk -F " " '{print $3}')`
do
    date=`date +%Y-%m-%d`
    pts=` w | grep $i | awk -F " " '{print $2}' `
    pid=`ps aux | grep bash | grep $pts | grep "-" | awk -F " " '{print $2}'`
    read -p "You mail :" mail
    if [ "$mail" = "chen_baocheng@ryoyo.com.cn" ]; then
        echo " Welcome sa "
        echo $date
    else
        echo "Sorry, you are not sa.I maust kill you! Godbye!"
        kill -9 $pid
    fi
done