12
submitted 3 months ago by [email protected] to c/[email protected]

On Ubuntu Server and Arch I was able to change the following line in /lib/systemd/system/[email protected]

# 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?

top 1 comments
sorted by: hot top controversial new old
[-] [email protected] 1 points 3 months ago

The likely cause is that agetty itself does not exit when the shell exits, it simply respawns the login command. You can confirm this if the PID of the agetty doesn't change.

If it does change (and systemd restarts the agetty process) then you might want to stop the service as one of the Exec statements of the service to prevent it from respawning.

this post was submitted on 23 Mar 2024
12 points (100.0% liked)

Linux 101 stuff. Questions are encouraged, noobs are welcome!

955 readers
12 users here now

Linux introductions, tips and tutorials. Questions are encouraged. Any distro, any platform! Explicitly noob-friendly.

founded 1 year ago
MODERATORS