why not is possible get time when user change password?

Support for security such as Firewalls and securing linux
Post Reply
Windows
Posts: 59
Joined: 2021/06/16 13:20:01

is possible get list of users by time when each user is created?

Post by Windows » 2021/10/04 19:24:45

hello, if we run

Code: Select all

cat /etc/passwd | cut -d: -f1 | sort
then we obtain list of users by NAME.

Is possible get list of users by time+date of creation?

Windows
Posts: 59
Joined: 2021/06/16 13:20:01

why not is possible get time when user change password?

Post by Windows » 2021/10/04 21:27:07

hello this commands chow DATE when user change password:

Code: Select all

chage -l root
chage -l root | head -1
passwd -S root
passwd -S root | awk -v user=root '{ if ( $1 == user ) { printf  "%s\n",  $3; } }'
why not possible obtain TIME ?

is limitation of CentOS, or police of security?

... me not understand this "shadow" in the time.


Thanks

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: why not is possible get time when user change password?

Post by jlehtone » 2021/10/05 12:27:44

man shadow wrote:long int sp_lstchg; // days since Jan 1, 1970 password was last changed
The format stores only integral values and unit is days.

If you would store user information in LDAP and or Kerberos, then you could have more accurate time data, because their formats do support much more than POSIX. Note that you do want local system accounts. Otherwise you might not be able to reach those services.

tunk
Posts: 1205
Joined: 2017/02/22 15:08:17

Re: is possible get list of users by time when each user is created?

Post by tunk » 2021/10/05 13:33:22

Assuming users don't edit their .bashrc: ls -l /home/*/.bashrc | more

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: is possible get list of users by time when each user is created?

Post by jlehtone » 2021/10/05 13:40:45

I presume that question is more about system accounts, which typically have no files from skel.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: is possible get list of users by time when each user is created?

Post by TrevorH » 2021/10/05 15:26:42

The command is sorting by the "days since last changed" field in /etc/passwd and that is in there as "number of days since Jan 1st 1970". There is no other date/time info in there that is more granular than "days" so, no, it's not possible to get a time value out of it.

Merged two more or less identical threads together.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply