HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Query user id's whcih are non-expiry

 
SOLVED
Go to solution
點燃
Valued Contributor

Query user id's whcih are non-expiry

Hi,

I've a couple of questions

1) How can I query the user id's on my system that are non-expiring accounts? It is a hp-ux 11i non-trusted one.

2) The system has only 20 entries in the /etc/passwd feild, however the logins command shows nearly 1200 users. This is an NIS client as well. Are these 1200 users are NIS users? How can I list only local users using logins command?

Thanks in advance for all your quick help!!
Man's mind, once stretched by a new idea, never regains its original dimensions
6 REPLIES
Shibin_2
Honored Contributor

Re: Query user id's whcih are non-expiry

You have the answer.

>> This is an NIS client as well.

Since it is NIS client, your local passwd doesn't have any effect. All user login are from your NIS.
Regards
Shibin
點燃
Valued Contributor

Re: Query user id's whcih are non-expiry

Thanks. I knew I've the answer, but my nsswitch.conf says; "passwd compat". Is'nt it mean both local & NIS users can login??

And, my actual questions were, 1)How can I list only local users using logins command?

2) How can I query the user id's on my system that are non-expiring accounts?

Thoughts?

Thanks again.
Man's mind, once stretched by a new idea, never regains its original dimensions
Solution

Re: Query user id's whcih are non-expiry

>1) How can I list only local users using logins command?

You can always operate directly on /etc/password. If the password field doesn't have a ",", the password doesn't expire.
Or logins(1m) says to use: -r local

>2) How can I query the user IDs on my system that are non-expiring accounts?

logins -x, or scan the /etc/passwd file:
awk -F: '$2 !~ /,/ { print "No expiration:", $1}' /etc/passwd
Or for NIS:
ypcat passwd | (above awk)
點燃
Valued Contributor

Re: Query user id's whcih are non-expiry

Thanks Dennis. However the -r local doesn't seems to be existing in 11i

TestHost:/root#logins -r local
Usage: logins [-admopstux] [-g groups] [-l logins]


Mit freundlichen Grüà en
Man's mind, once stretched by a new idea, never regains its original dimensions

Re: Query user id's whcih are non-expiry

>However the -r local doesn't seems to be existing in 11i

11i has been retconned to mean any of 11.11 AND on. Next time please be more specific about your OS version and use the "uname -r" value. I was looking at the 11.31 man pages.

In regards to using awk, you may want to ignore all "system" IDs with a "*" in the password field.
點燃
Valued Contributor

Re: Query user id's whcih are non-expiry

thanks.
Man's mind, once stretched by a new idea, never regains its original dimensions