Automated login and screen lock

My computer only has a single user that is used for normal log in.

On boot, it would be convenient of the system would log in that user automatically, and then optionally, lock the screen, such as by launching a password protected screen saver.

Suggestions?


Set your user for automatic login in System Settings -> User Accounts -> Automatic Login (you will need to press the "unlock" button and enter your password before you can change the automatic login setting).

The command gnome-screensaver-command -l will cause the screen to be immediately locked, which can probably be added to your autostart items.

Using gedit (or other text editor of choice), create /home/USERNAME/.config/autostart/screen_lock.desktop with contents:

[Desktop Entry]
Type=Application
Name=Lock Screensaver
Exec=gnome-screensaver-command -l

And hopefully it will automatically login and then lock the screen.


I'm using Ubuntu 18.04.1 LTS with Gnome 3.28.2 and this worked for me. Set a user to auto-login, either via the GUI or by editing /etc/gdm3/custom.conf. On the desktop, click on Show Applications, type in "Start" and you'll see the "Startup Applications Preferences", open it, click on Add, give it whatever Name and Comment you'd like and put the following in the Command input:

dbus-send --type=method_call --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.Lock

On re-boot, it will auto-login and immediately lock the screen for whatever user you set up in /etc/gdm3/custom.conf.