====== Auto Login ====== ===== Introduction ===== This document mainly introduces automatic login under Ubuntu. ===== Desktop OS ===== Edit file ''/usr/share/lightdm/lightdm.conf.d/50-greeter-wrapper.conf'' to add the configuration below: ``` [SeatDefaults] greeter-session=lightdm-gtk-greeter autologin-user=khadas ``` ===== Server OS ===== **For tty1-tty6**: ```shell sudo cp /lib/systemd/system/getty@.service /lib/systemd/system/getty@.service.backup sudo sed -i "s/ExecStart=.*/ExecStart=-\/sbin\/agetty --noclear --autologin root \%I \$TERM/g" /lib/systemd/system/getty@.service ``` **For ttyS0**: ```shell sudo cp /lib/systemd/system/serial-getty@.service /lib/systemd/system/serial-getty@.service.backup sudo sed -i "s/ExecStart=.*/ExecStart=-\/sbin\/agetty --autologin root --keep-baud 115200,38400,9600 \%I \$TERM/g" /lib/systemd/system/serial-getty@.service ``` Reboot to take effect. If you want to recovery the login prompt, please follow the steps below: ```shell sudo mv /lib/systemd/system/getty@.service.backup /lib/systemd/system/getty@.service sudo mv /lib/systemd/system/serial-getty@.service.backup /lib/systemd/system/serial-getty@.service ```