LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-04-2016, 02:55 PM   #1
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Rep: Reputation: 49
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?
 
Old 02-04-2016, 03:05 PM   #2
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,048

Rep: Reputation: Disabled
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.

Last edited by Didier Spaier; 02-04-2016 at 03:07 PM.
 
Old 02-05-2016, 12:32 AM   #3
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,141

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
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.
 
1 members found this post helpful.
Old 02-05-2016, 07:27 AM   #4
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
Thanks. Is that the timestamp when the account was created or when the password was last set?
 
Old 02-05-2016, 07:43 AM   #5
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,048

Rep: Reputation: Disabled
Quote:
Originally Posted by rjo98 View Post
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] sort based on timestamp? socalheel Programming 3 04-29-2015 05:52 AM
Factory Reset My Inspiron 10 Mini Running Ubuntu. (I Don't Have Passwd For Any Users) Pichito9 Linux - General 6 11-29-2014 05:52 PM
How to sort regular users and system users from /etc/passwd joeyBig Red Hat 9 05-29-2008 12:59 AM
How change password for kerberos users using passwd comand sarajevo Linux - Security 0 10-23-2007 04:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration