Operating System - HP-UX
1751860 Members
5411 Online
108782 Solutions
New Discussion юеВ

Re: Listing inactive users

 
Mahlathini
Occasional Contributor

Listing inactive users

Hi All

How do I list number of inactive users from /etc/passwd file.

I tried logins -x it does not help.
Thank you.
7 REPLIES 7
Steven E. Protter
Exalted Contributor

Re: Listing inactive users

Shalom,

You do not reveal the OS or security setup.

Try passwd -sa

This will help depending on OS level and security setup.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Mahlathini
Occasional Contributor

Re: Listing inactive users

The OS level hp-ux 11.11i and is a trusted system. I did try passwd -sa, it only shows the users and without passwd.
IG_2
Advisor

Re: Listing inactive users

Shalom,

What do you mean under "inactive"? Those who hasn't logon the host for some days or what? If this you can run the following pipe

# last | awk '{ print $1 }' | sort | uniq

It consumes a lot of memory but will give a list of user who have registered in OS. The rest from /etc/passwd are "inactive".
Mahlathini
Occasional Contributor

Re: Listing inactive users

Thanks it seems to be working.
Court Campbell
Honored Contributor

Re: Listing inactive users

With trusted systems you can set accounts to be locked after n number of days of inactivity. Once you set that up you could write a script to get the list of accounts from /etc/passwd. Then use a loop to run them through getprpw. All you'll need is the lockout field. If the second bit is a 1 then the account is inactive. Refer to man getprpw.
"The difference between me and you? I will read the man page." and "Respect the hat." and "You could just do a search on ITRC, you don't need to start a thread on a topic that's been answered 100 times already." Oh, and "What. no points???"
Haral Tsitsivas
Advisor

Re: Listing inactive users

"lastlog" shows the last login time for each user.
skt_skt
Honored Contributor

Re: Listing inactive users