How does ```Last login: Sun Dec 6 16:42:03 2020``` work?

Hi

When i start the TX2 devboard, it appears: Last login: Sun Dec 6 16:42:03 2020

How is the devboard capable of doing that? Where is that information stored? Can I modify the Time zone?

The “last” command is being run at the moment of login. The command itself is from package “util-linux”. The log file is at “/var/log/lastlog”.

I’m not sure of the relation, but part of this is probably generated from “/var/log/wtmp” and “/var/log/btmp”. All of this is a standard part of “init” and login scripts which is the first user space software run after the kernel loads.

I am only guessing, but probably “systemd-logind.service” is the code/script which enables the saving of this information. This is standard for all Linux distributions I know of.

1 Like