How to know when a user was created? but explicitly according with the version of Ubuntu itself

Hello friends

I know the sudo adduser <username> creates:

  • a user
  • a password
  • home directory
  • GECOS (as optional)

Suppose were executed the following commands in the same machine but in different points of time according the version of Ubuntu itself as follows:

  • sudo adduser commanderkeen when Ubuntu Desktop was 18:04
  • sudo adduser tron when Ubuntu Desktop was 20:04
  • sudo adduser captainfuture when Ubuntu Desktop was 22:04

How would be possible to know under what specific Ubuntu version was created a specific user? For example: for the tron user should be indicated that was created when Ubuntu was 20.04. Is possible accomplish this goal?

Thank You

I don’t think, it is possible to retrieve this information historically, unless you keep your system logs for eternity.

In the latter case (you do keep your system logs forever), you would have to search them for the specific events (upgrades and user adds).

If you want to keep such information in the future, I would recommend, you create a shell script that runs periodically and stores all information you want to keep in a database (or just a file).

3 Likes

Depending on implementation - sometimes - if you’ve got time - the old UNIX command “last” might show you “where, how, when, from where (e.g. which IP address)” something happened or occurred…

3 Likes

By default there are no absolute reliable ways to check when a user was created or which version you were using at the time outside of self kept logs, however there are a few files you can check which may be useful if you haven’t edited them since creating the account.
One file not very often edited is the .bash_logout file, which you can check the last modified date by doing ls -l /home/USERNAME/.bash_logout.
Another method would be checking to see which date the password was last changed (if you haven’t changed it since the user creation it should be accurate) by doing chage -l USERNAME.

While not a perfect solution, it may help you line up the dates with Ubuntu releases

3 Likes

Thanks for your suggestions.

The mentioned file was never touched and the password was never edited. Let me confirm the two approaches to mark your answer as final solution.

Thank You.

1 Like