Ubuntu – How to get a command to run before login (ie while booting or just after)

bootbrightnesscommand linestartup

I have an encrypted home folder, so I can't log in automatically (and I wouldn't want to) but also my display defaults to the minimum brightness at each boot. To fix this I run the command

`xbacklight =100`

as a startup application, but this only runs when I log in and not when a guest logs in or for the login screen which is beautiful, but not seen.

A fix for the whole issue would be preferred, or just a way to run commands during the boot process. Thanks.

Best Answer

You can edit /etc/lightdm/lightdm.conf and append the line


to the [SeatDefaults] section. Then create the file /usr/local/sbin/lightdm-setup.sh with this content:

#! /bin/sh
xbacklight =100

And make the file executable (chmod +x /usr/local/sbin/lightdm-setup.sh). After a reboot or when you restart lightdm (sudo restart lightdm) your script should run.

Related Question