How to Automatically Login to Linux

For Project Spoofy, I’m using fbi to pull photos from ownCloud and display them automatically on screen with no further input. In order to do this properly, the system must automatically login to Linux without a password. What’s more, I need the system to login as root so that fbi will have access to the proper folders to display images. Since we’re working on a Raspberry Pi, note that these instructions are specific to Debian and it’s derivatives.

How to automatically login to Linux

To do this, we simply need to edit the getty@.service file

sudo nano /lib/systemd/system/getty@.service

Then change the file that reads ExecStart=-/sbin/agetty --noclear %I $TERM to ExecStart=-/sbin/agetty --noclear -a USERNAME %I $TERM

Adding the -a option will enable autologin for the USERNAME that follows, so -a root will automatically login to the root account.

Leave a Reply