Finding Out User Creation Date and Time

Q1: How to Find Out When a User is Created in Linux?

Answer:

cat /etc/passwd | grep <username> 

If the user is not there the above command will not return any value else will return the attributes of the user. 
 

Q2: How to find if the customer want which date the user is created e.g. the exact date & time?

Answer:

There is no default or standard way for determining the user creation date in Linux. The best practice is to include the -c or comment option when creating a user.  You can put the creation date in the comment. 

There are some things you can do to get the creation date but all of them depend on a specific set of circumstances and/or software to determine that date and time. 

For example, if created and not touched since the user creation you can use the .bash_logout file to determine the date. 

As root run 

ls -l /home/<username>/.bash_logoutls -l /home/<username>/.bash_logout

If the user was created recently and your log files have not been rotated out (usually about 4 weeks) you can check /var/log/messages for 'useradd'. The useradd line will include the date and time. 

If you have tripwire installed and running AND it is setup to watch /etc/passwd then there will be an entry for each time a password is created or changed and by whom. 

If the user has a home directory, you can check that directories creation date 

ls -ld /home/username/ls -ld /home/username/

If using auditd you can search for the user creation 

aureport –auth | grep melbinaureport –auth | grep melbin

There are other methods but again, it all depends on your setup. 

Linux Tips

See Also
Calculate Disk Queue Length And Disk Busy Time

Have a Linux Problem
Linux Forum - Do you have a Linux Question?

Linux Books
Linux Certification, System Administration, Programming, Networking Books

Linux Home: Linux System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.