Operating System - HP-UX
1833771 Members
2227 Online
110063 Solutions
New Discussion

Re: how can I find users who has did not login for 30 days!

 
SOLVED
Go to solution
lin.chen
Frequent Advisor

how can I find users who has did not login for 30 days!

how can I find users who has did not login for 30 days!thanks!
5 REPLIES 5
Peter Godron
Honored Contributor

Re: how can I find users who has did not login for 30 days!

Hi,
if your accounting system is working, with last

Peter Godron
Honored Contributor
Solution

Re: how can I find users who has did not login for 30 days!

Ivan Krastev
Honored Contributor

Re: how can I find users who has did not login for 30 days!

This could help:

for i in `awk -F: '$3 > 100 { print $1 }' /etc/passwd`; do last $i | head -1 ; done


cheers,
ivan
Vipulinux
Respected Contributor

Re: how can I find users who has did not login for 30 days!

Hi

Check this

#!/bin/sh
#
# Gives a list of users who have not logged in this month.
#
PATH=/bin:/usr/bin;export PATH
umask 077
THIS_MONTH=`date | awk '{print $2}'`
/bin/last | /bin/grep $THIS_MONTH | awk '{print $1}' | /bin/sort -u > /tmp/users1$$
cat-passwd | /bin/awk -F: '{print $1}' | /bin/sort -u > /tmp/users2$$
/bin/comm -13 /tmp/users[12]$$
/bin/rm -f /tmp/users[12]$$

Cheers
Geoff Wild
Honored Contributor

Re: how can I find users who has did not login for 30 days!

finger them!

for USER in `cat /etc/passwd | awk -F: '{print $1}'`
> do
> finger $USER
> done


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.