一个群友写的脚本,蛮经典的:
Linux记录键盘操作[code]# /bin/sh
# hist_record.sh
# This script is often to write in /etc/profile.
# This script could record history input and send mail to root.
RMIP=`who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'`
TIME=`date +%Y%m%d.%H:%M.%S`
if [ "$RMIP" = "" ]
then
RMIP=`hostname`
fi
LOGS="/tmp/.hist/$TIME.$USER.$RMIP.hist"
HOST=`/bin/hostname`
if [ ! -d /tmp/.hist ]
then
mkdir /tmp/.hist
chmod 777 /tmp/.hist
fi
script -q $LOGS && mail -s "$TIME, $USER FROM $RMIP LOGIN $HOST" root < $LOGS[/code]
kelre 于 2008-10-22 12:07:49发表:
(5ty(
Fedoranew 于 2008-10-12 00:23:57发表:
就这么一点就可以了。。。?
tarena 于 2008-10-11 21:57:35发表:
强5:ty(