How do I add PrintLastLog flag to sshd so that it displays at login ?

  • I would like to enable the SSH PrintLastLog option, so that it displays before the standard MOTD as follows:-

    Code
    Last login: Sat Mar 23 20:31:23 2024 from 192.168.1.2
    ##############################################
    #                 LibreELEC                  #
    #            https://libreelec.tv            #
    ##############################################
    
    LibreELEC (community): nightly-20240311-86dba4b (Generic.x86_64)
    LibreELEC:~ #

    It's part of the vanilla OpenSSH sshd configuration options and is listed as a commented out flag in LibreELEC's /etc/ssh/sshd_config ...

    Code
    #PrintLastLog yes

    The normal LibreELEC method of supplying sshd overrides via /storage/.cache/services/sshd.conf ...

    Code
    SSH_ARGS=""
    
    e.g.
    
    SSH_ARGS="-o 'PrintLastLog yes'"

    ... doesn't work. I've tried various ways to quote-encapsulate and supply yes|true|on|=yes|=true|=on type Boolean arguments to the -o options but haven't got anywhere.

    Am I just mangling the syntax for a thing that *should* work, or is the LibreELEC sshd compiled without that particular bit of functionality that the regular OpenSSH one has ?


    Thanks.

  • PrintLastLog is a config not runtime option so the correct way would be copying /etc/ssh/sshd_config to /storage/.ssh/sshd_config and edit the file there, then add "-f /storage/.ssh/sshd_config" runtime args to /storage/.cache/services/sshd.conf so it uses the modified file not the embedded read-only one. The modified args work, but I wasn't able to get lastlogin to appear /shrug

  • Ah. I *think* I see what you are getting at, but I'm not at all a code-wrangler, so please correct me if I've misunderstood, or missed your point entirely...


    If the utmp/wtmp options are explicitly not compiled in then there's simply no data for the PrintLastLog function to present ?


    EDIT:

    Doh - I'm blind - I completely missed the --disable-lastlog line outright.

    Thanks for the quick answers. :thumbup:

    Edited 2 times, last by kurai: Doh - I'm blind (March 25, 2024 at 2:47 AM).