14
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 3 comments
sorted by: hot top controversial new old
[-] [email protected] 2 points 3 months ago

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

[-] [email protected] 2 points 3 months ago* (last edited 3 months ago)

Try adding these two options to the service

Type=oneshot
RemainAfterExit=yes
[-] [email protected] 1 points 3 months ago

Changing Type=oneshot and adding RemainAfterExit=yes underneath does not allow me to boot into my system. I get this as the last terminal message

[ OK ] Reached target Cloud-init target.

No biggie to fix since I did this in a Virtual machine and could restore to an older snapshot.

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

linux4noobs

980 readers
3 users here now

linux4noobs


Noob Friendly, Expert Enabling

Whether you're a seasoned pro or the noobiest of noobs, you've found the right place for Linux support and information. With a dedication to supporting free and open source software, this community aims to ensure Linux fits your needs and works for you. From troubleshooting to tutorials, practical tips, news and more, all aspects of Linux are warmly welcomed. Join a community of like-minded enthusiasts and professionals driving Linux's ongoing evolution.


Seeking Support?

Community Rules

founded 11 months ago
MODERATORS