Operating System - HP-UX
1824963 Members
3476 Online
109678 Solutions
New Discussion юеВ

Re: how to find when a user is created

 
Khashru
Valued Contributor

how to find when a user is created

I want to find out when (date) a user account is created in hpux. Is there any command. I can check by user home folder creation date. but i need it to be done from command line.
8 REPLIES 8
RAC_1
Honored Contributor

Re: how to find when a user is created

If system is in trusted mode, you may be. But I don;t think such an information is stored.

/usr/lbin/getprpw "user_name"

Also look at passwd -sa command.
There is no substitute to HARDWORK
Sunny Jaisinghani
Trusted Contributor

Re: how to find when a user is created

Hi,

i don't know if there is a way to know the exact date of user creation.

However you can guess the approx span in which the user got created by having a look at /etc/passwd.

if any user is added the entry for that user is appended. so by having a look at the depth of /etc/passwd file there is a chance u can guess. however it is difficult.
Khashru
Valued Contributor

Re: how to find when a user is created

No luck.
Anshumali
Esteemed Contributor

Re: how to find when a user is created

Unix doesn't maintain file creation date.

Though you can check the files like .profile, .kshrc, .login if they aren't modified since then or you can configure a logging through a script when you create a new user.
Dreams are not which you see while sleeping, Dreams are which doesnt allow you to sleep while you are chasing for them!!
Peter Godron
Honored Contributor

Re: how to find when a user is created

Peter Nikitka
Honored Contributor

Re: how to find when a user is created

Hi,

you can do nothing for the past, but for future data I'll attach my script "upd_passwd_log" (includes support for /etc/shadow) which is run via a crontab entry like this on all relevant servers:
0 6,9,12,15,18,21 * * 1-5 /root/bin/upd_passwd_log

Configure the variable
PWdir
to your needs.

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
James R. Ferguson
Acclaimed Contributor

Re: how to find when a user is created

Hi:

> I can check by user home folder creation date...

Please, there is no such thing as a creation date in Unix. The closest you can come is the 'mtime' which represents the last *modification* timestamp. Coincidentally, at the time a file or directroy is first created its 'mtime' can be said to be its creation timestamp, but thereafter any changes modify the timestamp value. For directories, additions and deletions of files to the structure modify 'mtime', obliterating the original 'mtime' or "creation" information.

Regards!

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

Re: how to find when a user is created

There is nothing in UNIX that will do this for you just as there is nothing that will tell you when a user was deleted/removed. If one needs to track these data then one needs to create a database and one's user add and user delete scripts need to update this database. Note that this database can be a flat file but the point is that there is no built-in facility for this task.

... and has already been mentioned UNIX has absolutely no concept of the creation date of a file. If that happens to coincide with a files mtime or ctime, it is purely accidental.
If it ain't broke, I can fix that.