LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Sort users in /etc/passwd by timestamp of last password reset (https://www.linuxquestions.org/questions/linux-newbie-8/sort-users-in-etc-passwd-by-timestamp-of-last-password-reset-4175571440/)

anon091 02-04-2016 02:55 PM

Sort users in /etc/passwd by timestamp of last password reset
 
is it possible to sort users in /etc/passwd by timestamp of the last time their password was reset?

Didier Spaier 02-04-2016 03:05 PM

Of course no, as no timestamp is registered in this file.

Unless yours have a specific format that includes it. If yes, please tell us what is this format.

JJJCR 02-05-2016 12:32 AM

try this:

passwd -S <User_Name>

To use against /etc/passwd i guess you can create a small script to loop and use in conjunction with the passwd -S

My system has this output:

<user_name> PS 1998-06-01 0 99999 7 -1 (Password set, MD5 crypt.)

Which means last password change for the user was June 1, 1998.

anon091 02-05-2016 07:27 AM

Thanks. Is that the timestamp when the account was created or when the password was last set?

Didier Spaier 02-05-2016 07:43 AM

Quote:

Originally Posted by rjo98 (Post 5495626)
Thanks. Is that the timestamp when the account was created or when the password was last set?

To know that, just type:
Code:

man passwd


All times are GMT -5. The time now is 03:58 PM.