I have been trying to get my laptop's [screen brightness to default to a low setting](https://askubuntu.com/q/411897/17041), and for my [keyboard light to be off](https://askubuntu.com/q/415145/17041) when I start my computer.

I have these two commands that work when I execute them at the command line:

```
xbacklight -set 7
echo 0 | sudo tee /sys/class/leds/asus::kbd_backlight/brightness

```

I put them in my `/etc/rc.local` file, like so:

```
#!/bin/sh -e
# ...
# By default this script does nothing.
echo 0 | tee /sys/class/leds/asus::kbd_backlight/brightness
xbacklight -set 7
exit 0

```

However, neither command executes. (I was told that the `sudo` was not needed in the second command when placed in `/etc/rc.local`)

There was [another question asking the same thing about `rc.local`](https://askubuntu.com/q/299792/17041), but I tried to also include my commands using the Startup Applications GUI interface. That also did not work, so I think the problem might go beyond just the `rc.local` file. Other default startup commands in the list seem to start, so far as I can tell.

Why am I unable to get any custom command line to execute when I startup?

---

**New:** After some experimentation, it seems like the commands I put in `/etc/rc.local` might be getting executed *before* the login screen. So, my login screen has the screen appropriately dimmed. However, then when I login, my screen goes to maximum brightness. So it seems like perhaps there is some other setting that is being applied when I log in, or that `/etc/rc.local` only applies for the login screen itself and has no bearing on what happens to a user when logged in.

So, how do I resolve this so that the brightness and keyboard light settings I want apply to the user login session, not just to the login screen?