Add compact mode to last#54
Conversation
- pass the cmd ID to usage() so that it knows, what to show - let all sub commands accept -v and -h - if no sub command is given, ignore the -f ... option (not needed)
- per default show session duration with a precision of seconds - in legacy mode (option -L or if called as 'last') use minutes for backward compatibility
- see thkukuk#47 - use option -u to show the most recent log entry for each user, only. - option letter u: inspired by 'sort -u' (unique)
Introduce a new --compact (-c) option for the `last` command. When enabled: - The logout timestamp column is hidden. - The login datetime defaults to YYYY-mm-dd HH:MM:SS. This reduces redundant information in the output, makes the output more precise and easier to read and parse. Fixes thkukuk#53
|
See jelmd@9f7ac3c |
|
Just a couple of suggestions as an observer: if you want your proposal to be considered I would advise:
|
|
@andy-bower yes, thanx. Github UI choose the wrong branch and I didn't noticed it, because there is no preview. That's why the hint to just cherry-pick jelmd@9f7ac3c Example out: |
Your ssh daemon does not report the TTY if you see "ssh" here, there are patches missing. |
Depends. Actually, [since this would be a virtual device anyway,] it’s not really necessary. The PID would be more interesting if the session hasn’t ended yet. But as mentioned, for running sessions And importantly, sshd still writes its entries to |
|
Hi @jelmd,
Where 'w' and 'who' get their records also "depends". It's a bit of a mess really. If you want to know what is happening now you might be best off looking at the process table..
sshd doesn't need patching for this - libwtmpdb linkage is a build option. However, I do wish that there were some pam capability that would let us deduplicate these entries somehow so you could add the richer data in a specific ssh daemon without having to universally block duplicate records from libpam-wtmpdb with |
|
Hi @andy-bower, oops, thought I had already answered this one.
On Ubuntu/Linux,
Yes, but the point is that when someone uses
Well, the ancient stuff probably does, newer tools shouldn’t. Therefore, IMHO it’s better to leave it alone and let them trash it as they like - if I have something more reliable like wtmpdb ;-).
Hmmm, IMHO all ancient tools need to be patched so they no longer use wtmp* at all. Instead, they should rely on PAM, and if they do, a PAM module like pam_wtmpdb is sufficient and authoritative for what one needs to know about session history. If the authenticating tool wants to log|provide more details, it can do so in its own logs and provide the proper commands to retrieve that information.
Well, if tools behave properly, duplicates would never occur, because the related PAM module would be the only component writing to the database.
Yeah, that’s IMHO the right thing to do - excellent! All ancient stuff (written when PAM wasn’t available or even known, and therefore using such ugly kludges like *wtmp(3)) should be fixed to use PAM and stop scribbling into wtmp, which is IMHO pretty dirty and probably the root cause of various not-so-well-thought-out ideas like wtmpdbd. Anyway, in my current version I cleaned up the |
|
@jelmd my observation was a technical aside so addressing from that point of view:
OK! That's not my recollection from patching
This is now fixed in
You seem rather certain about this. It seems to me that PAM is a framework, with its own benefits and limitations. openssh-server has its own reasons for doing things which may not map 100% onto that framework. I suspect PAM developers would acknowledge the limitations - most people are aware of limitations in their own software. |
Fixes #53: hide logout time and set login time format default to 'compact' (YYYY-mm-dd HH:MM:SS).