1847086 Members
5311 Online
110262 Solutions
New Discussion

Re: user list

 
joe_91
Super Advisor

user list

ona 11.11 machine, I need to obtain a list of all active users and when their accounts were created.
How can i get this info?

Thanks

Joe
6 REPLIES 6
James R. Ferguson
Acclaimed Contributor

Re: user list

Hi Joe:

The 'logins' command (see the man pages for more options) is one way to list users.

http://docs.hp.com/en/B2355-60127/logins.1M.html

As for any creation timestamp, Unix doesn't track creation. About the best is the coincidence of an unmodifed file's 'mtime' being equivalent to the moment of its creation.

Since directories have their 'mtime' updated as files are added and removed, this isn't a fool-proof indication either. Inference but not proof is as good as it gets when it coms to tracking "creation".

Regards!

...JRF...
A. Clay Stephenson
Acclaimed Contributor

Re: user list

logins -x is a good starting point; however, when an account was first created (or disabled) is not recorded. If you know that data (for example, by looking at the ctime (which is change time, not creation time) on a file in a user's home directory, you only know the creation time by accident. UNIX has no concept of the creation time of a file.

If you want to know these data (and it's becomingly increasingly common under security audit's) then you must create a database that stores the info and adopt strict procedures that always add and disable users in scripts thats update this database. The bad news is that this needed to be thought of on the front end.

If it ain't broke, I can fix that.
inventsekar_1
Respected Contributor

Re: user list

"to obtain a list of all active users"

#cut -d : -f 1,2 /etc/passwd

will give you the username and encrypted passwd. if the user is not active, that will be *. so u can find out the list of active users.

when their created is not availble. from the above responses, u can find that.



Be Tomorrow, Today.
Marc Ahrendt
Super Advisor

Re: user list

another option is to run "ls -last" in each $HOME of your users ...not accurate (as explained earlier) but possibly your best approximation, another option is looking at the output of "last"

i manually track all accounts added and removed on my systems to get an accurate time of when accessed was given and/or taken away
hola
siva baskaran
Regular Advisor

Re: user list

hi,

that is simple way
list out all the users list

use logins cmd
user whodo cmd to active users list
use id username ( id root) to find details or users

do need yet more?

thanks
siva
Steven E. Protter
Exalted Contributor

Re: user list

Shalom joe,

I like passwd -sa

Though this may only work on trusted systems. I know it does not work on 11.00 systems.

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