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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find old user account 1

Status
Not open for further replies.

samjoo

Technical User
May 24, 2004
51
hi!

I want to know how to get user list that not accessed the system more than two month.
Does eveyone knows shell script or command?

Thanks in advance!
 
I'm sorry to Mag0007!

I didn't find it what i want in the 'last'command.

I'd like to know username that not use more than two month.

can you explain me about 'last'command?
 
Does this help?

Code:
#!/bin/ksh
# # # # #
# report users that have not logged for 2 months or more (60 days)
# # # # #
# get time in EPOCHDATE format and substract 60 days
NOW=$(perl -we "print time")
((TWOMONTHS=NOW-60*(24*60*60)))
# # # # #
# list all users that have logged in at least once
# find out if their last login time is older than 60 days ago
lsuser -a time_last_login ALL|\
 grep time_last_login=|\
 sed 's/time_last_login=//'|\
 while read user tll
 do
  if ((tll<TWOMONTHS))
  then
   printf "%s has not logged in for 60 days\n" ${user}
  fi
 done


HTH,

p5wizard
 
hi! p5wizard!

Thanks for your help!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top