Operating System - HP-UX
1751960 Members
4547 Online
108783 Solutions
New Discussion

Re: 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 6
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
Dennis Handly
Acclaimed Contributor
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
Dennis Handly
Acclaimed Contributor

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