Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to build a report to find who has not logged in for a while

Status
Not open for further replies.

DiscJockey

Technical User
Apr 15, 2005
11
US
I am new to the UNIX world and was given a small project to do. I need to build a little script to tell me who has not logged into the system for the last 180 days. I also need to have it email the results to my email address once a week. Any help would be greatly appreciated.
 
You should have a look at the man page for finger and mailx. Its worth posting your question in the unix scripting forum.
 
Ok, I have found where the logins are stored. They are in the /var/adm/wtmp file, and listusers will tell me all the users that are on the system. Does anybody know how I would compare the two files to determine who has not logged in in the last 6 months or 180 days? The wtmp file only goes back for about 6 months. I would think that I need to somehow compare the files and determine if any of the users on the system are not in the wtmp file. I have no idea how to do that though. Any help would be greatly appreciated.
 
last shows all the logins working backwards from today. What I need to know is who has not logged in for the last 180 days.
 
One option.
Create a list of users who can login to the system from /etc/passwd. Then every 7 days, extract a list of users who have logged in via "last".

Compare the last list, again the valid users...

Implement LDAP with a password policy - this can be configured to inactivate unused accounts.

--
Jack
 
I found out that I had an Oracle DB with all the info I needed. I was able to build a script and have it run via cron once a week. Thanks a lot for all your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top