Sunday, March 8, 2009

Script to find normal users above UID 500

Script to find normal users above UID 500 and their Shell History. This works in Linux. Other NIXes may require modification.


#!/bin/bash
USERS=`grep ":5*:*:" /etc/passwd | grep "/bin/bash" | awk -F: '{print $1}'`
HOME=`grep ":5*:*:" /etc/passwd | grep "/bin/bash" | awk -F: '{print $6}'`
for i in $USERS
do
egrep -i "reboot|init|shutdown|halt|poweroff" `grep $i: /etc/passwd | cut -f6 -d:`/.bash_history
done

1 comment:

OrLaNd said...

Nice Blog
I enjoy this blog

Pls visit my blog at:
http://dalvindoorlando.blogspot.com

Best Regard,
OrLaNd
@@@ INDONESIA @@@