[SunRescue] users

Jonathan Katz rescue at sunhelp.org
Mon Mar 5 14:27:05 CST 2001


Wally once asked:
>How do I find out users who have not access the system in three months. Some users have left the company and I am trying to delete their account.

Provided your utmp is big enough/recent:

for X in `cat /etc/passwd | awk -F: '{ print $1 }'`; do
	if [ last $X | awk '{ print $5 }' | /usr/xpg4/bin/grep -v -e Jan -e Feb -e Mar ]; then
		echo "$X hasn't logged in for a long while!"
	fi
done

You can play with the string that the echo in
the 'if' loop reports, and force it to do
something in comma seperated format if you want
to carve out results and have management insert
it into a spreadsheet of some-sort.

-Jon



More information about the rescue mailing list