When "UseLogin" is set to yes, last command shows two entries for a single user. example: last -5 michael pts/0 Wed May 4 21:32 still logged in michael pts/0 Wed May 4 21:32 still logged in michael pts/0 Wed May 4 21:22 - 21:22 (00:00) root pts/tb Wed May 4 21:21 still logged in root pts/ta Wed May 4 21:18 still logged in
Created attachment 896 [details] Patch for one wtmp entry if uselogin is enabled This happens because login on invocation writes its own entry in wtmp files. To avoid I made OpenSSH code not to write in the wtmp file if uselogin is enabled. I like to hear comments on the approach for the attached patch. This solves the problem in my system and Im not sure about any side effects? Also Im not sure why the function login_utmp_only() is doing entry in wtmp?
(In reply to comment #1) > I like to hear comments on the approach for the attached patch. This solves > the problem in my system and Im not sure about any side effects? Well it will change the behaviour on other platforms. Not sure if that will break anything else or not. Perhaps it ought to be enabled only on HP-UX? >Also Im not sure why the function login_utmp_only() is doing entry in wtmp? Not sure. I looked in the CVS logs. It's been that way for a long time (at least since 2001).
Created attachment 908 [details] Optimized patch for HP-UX The patch is optimized and tested. I feel this duplicate entry problem occurs only in HP-UX and not sure in other platforms which have LOGIN_NEEDS_UTMPX defined in config.h of OpenSSH.
UseLogin is deprecated in OpenSSH 7.4
closing resolved bugs as of 8.6p1 release