1833018 Members
2130 Online
110048 Solutions
New Discussion

Time user was created

 
Joe J_1
Frequent Advisor

Time user was created

Hello,

Is there anyway to tell when a user was created on an 11.11 system?


Joe
6 REPLIES 6
James R. Ferguson
Acclaimed Contributor

Re: Time user was created

Hi Joe:

Only by inference. Unix does not maintain any notion of a "creation" time. The closest you get is a file or directory's last modification time --- 'mtime'.

With directories, the 'mtime' is updated as entities are added and/or removed.

Hence, the answer to your question is "no, not with assurance; only by inference".

Regards!

...JRF...
spex
Honored Contributor

Re: Time user was created

Joe,

Study the hidden files in the user's home directory. As long as a "skeleton" file hasn't been modified since user creation, you can infer the creation time.

PCS
A. Clay Stephenson
Acclaimed Contributor

Re: Time user was created

If you know this, it is only be accident and cannot in any sense be trusted. UNIX has no notion of the creation time of a file. If (for security reasons), you need to keep up with when a user was created and/or deleted/disabled then you have to craft custom scripts and maintain that data in some sort of database -- even if that database is simply a text file.
If it ain't broke, I can fix that.
Victor Fridyev
Honored Contributor

Re: Time user was created

Hi,

You can look for that in the /var/log/samlog file, but I'm not sure that SAM writes details of its operations. If the user has been created by useradd, any chance to know the user's creation date.
If you can guarantee that all users are created by SAM, use the option of running a script after user creation. I use this and write date of user creation into comment field.

HTH
Entities are not to be multiplied beyond necessity - RTFM
Joe J_1
Frequent Advisor

Re: Time user was created

Thanks for the comments. That's what I thought.
Yang Qin_1
Honored Contributor

Re: Time user was created

If you just want to check a specific user and
1. you created this user from SAM and you still have a "complete" /var/sam/log/samlog maybe you have a chance to find a record there.

2. If that user has not touched his .profile, .login .kshrc then you can find the information from time stamp of these files.

3. if you never reset your /var/adm/wtmp or you believe that file contain the information long before the user created you can run "last username" to trace when is the first time that user logged on to your server.

4. sometime a very old backup tape may help.