Auto login ubuntu
If you want to bypass the login prompt (such as in a graphical interface) or enable auto-login for a user:
For Command Line (Terminal) Auto-Login:¶
- Auto-login in a non-graphical environment:
Edit the /etc/systemd/system/getty@tty1.service.d/autologin.conf file (create it if it does not exist):
bash
sudo mkdir -p /etc/systemd/system/getty@tty1.service.d
sudo nano /etc/systemd/system/getty@tty1.service.d/autologin.conf
Add the following content:
ini
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin username --noclear %I $TERM
Replace username with the actual username you want to auto-login.
- Auto-login in a graphical environment:
If you're using a display manager (like gdm, lightdm, or sddm), you need to configure it for auto-login:
-
For LightDM:
Edit the LightDM configuration file:
bash sudo nano /etc/lightdm/lightdm.confAdd or modify the following lines:
ini [Seat:*] autologin-user=username autologin-user-timeout=0Replace
usernamewith your actual username. -
For GDM (GNOME Display Manager):
Use
gsettingsto set auto-login (ensure you have thegnome-control-centerpackage installed):bash sudo gsettings set org.gnome.login-screen auto-login-user 'username' sudo gsettings set org.gnome.login-screen auto-login-enabled trueReplace
usernamewith your actual username. -
For SDDM (Simple Desktop Display Manager):
Edit the SDDM configuration file:
bash sudo nano /etc/sddm.confAdd or modify the following lines:
ini [Autologin] User=username Session=your-session.desktop