{{indexmenu_n>15}}
====== Edge-2L auto login ======
===== Introduction =====
This document introduces how to set up automatic login on Ubuntu.
===== Desktop OS =====
// Settings => Users => Automatic Login //
===== Server OS =====
=== Virtual consoles tty[1-6] ===
```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
```
=== Serial console 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 1500000,115200,38400,9600 \%I \$TERM/g" /lib/systemd/system/serial-getty@.service
```
Reboot for the changes to take effect.
To restore the login prompt, follow these steps:
```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
```