Skip to content

Instantly share code, notes, and snippets.

@lfir
Last active August 14, 2017 12:30
Show Gist options
  • Save lfir/a635338f6b7797e8b56aad5880ce7668 to your computer and use it in GitHub Desktop.
Save lfir/a635338f6b7797e8b56aad5880ce7668 to your computer and use it in GitHub Desktop.
Set autologin in lightdm configuration file to the currently logged in user.
#!/bin/bash
#Tested on Fedora 25 MATE (lightdm version 1.18.3).
conf=$"[SeatDefaults]
autologin-user=$USER
autologin-user-timeout=0"
echo "$conf" | sudo tee '/etc/lightdm/lightdm.conf.d/custom-local.conf'
#Another way but may be overwritten with updates.
#sed -i -e '1,/^\[Seat:\*\]$/b' -e "s/^#autologin-user=$/autologin-user=$USER/" /etc/lightdm/lightdm.conf
#sed -i -e '1,/^\[Seat:\*\]$/b' -e 's/^#autologin-user-timeout=$/autologin-user-timeout=0/' /etc/lightdm/lightdm.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment