Server/Headless Linux: enable automatic login to a user on boot but when the user logs out, it will not re-login back into the user? - eviltoast

On Ubuntu Server and Arch I was able to change the following line in /lib/systemd/system/getty@.service

# Before
ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear %I $TERM


# After
ExecStart=-/sbin/agetty --noissue --autologin john %I $TERM Type=idle

And it works, that it will login to the user john but when I logout of the user john with using exit in the terminal, it logs john back in. Is there a way to change this ExecStart setting to enable auto login for a user on startup but only on startup?

  • Vilian@lemmy.ca
    link
    fedilink
    arrow-up
    2
    ·
    8 months ago

    maybe a second service, that when you log in, the service get enabled, and that service block your first service?