Operating System - HP-UX
1834285 Members
3756 Online
110066 Solutions
New Discussion

Re: which users are activated

 
SOLVED
Go to solution
Tuan Nguyen
Regular Advisor

which users are activated

Hello, admins

System: 9000 server
OS: hpux 11.0 and 11.11
From command line, how do I find out which user is activated and which one is not?

Thank you in advance for your help.

Tuan
9 REPLIES 9
A. Clay Stephenson
Acclaimed Contributor

Re: which users are activated

logins -x. Locked accounts will display "LK". Man logins for details.
If it ain't broke, I can fix that.
Steven E. Protter
Exalted Contributor

Re: which users are activated

Shalom Tuan,

passwd -sa

May be useful.

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
Tuan Nguyen
Regular Advisor

Re: which users are activated

Clay,

Thanks for your prompt response. I look into SAM and see many accounts which are de-activated. However, logins -x shows PS on a de-activated accounts.

Any suggestion?

I appreciate your help.

Tuan
David Bellamy
Respected Contributor

Re: which users are activated

passwd -sa is the right command to run it will show you all the active and deactive accounts.
Tuan Nguyen
Regular Advisor

Re: which users are activated

Steven,

Thank you for your response. passwd -sa also shows PS on deactivated accounts.

Tuan
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: which users are activated

There are a number of reasons that an account is no longer active but it may not be locked either. On a trusted system (which you appear to be) do this:

#!/usr/bin/sh

listusers | awk '{print $1}' | while read U
do
LK=$(/usr/lbin/getprpw -r -m lockout ${U})
echo "${U}\t${LK}"
done

If the lockout field consists of all zero's then the account is active but if there is a '1' in any position; the account is locked/expired/... . The position of each '1' is significant as it relates to the specific reason for an account lock. Man getprpw for details and pay attention to the section that describes "lockout".

NOTE: Only your 11.11 box will have a man page for getprpw.
If it ain't broke, I can fix that.
Tuan Nguyen
Regular Advisor

Re: which users are activated

Clay,

You are super admin. Thank you very much for your help.

Again, I would like to thank everyone for your help. Points will be assigned shortly.

Tuan
Tim Nelson
Honored Contributor

Re: which users are activated

I use a quick script that uses the getprpw command to derive the status of a user id.

cat list of users into loop that executes the following for each.
getprpw -m lockout $user
then use the lockout code to determine.

i.e.

/usr/lbin/getprpw -m lockout $list|awk -F= '$2 != "0000000" {print "DEACTIVATED"}'
Tuan Nguyen
Regular Advisor

Re: which users are activated

Tim,

Thank you for your help.

Thank you, everyone.

Tuan