How do you protect Ubuntu login?

I seem to remember that a few years back, in order to login on Windows you had to type Ctrl-Alt-Del to get a login screen.

The advantage of this was that if you had a cat or child that liked to press random keys on your computer keyboard, they wouldn't screw things up. Well, my kids are in their 40s now, but I do have a cat that likes to walk over the keyboard from time to time, and believe it or not - that requires a reboot to recover from the consequences.

Is there anything (short of hiding the keyboard) that can be done about this?


Solution 1:

Switch to virtual console x (x ≥ 8) (CtrlAltFx, say x = 12). Those don't have getty or LightDM (or anything, really) running on them, so the cat can walk over the keyboard to its heart's content. Then press CtrlAltF7 to get back to LightDM and the login screen.

You could automate this during boot by adding chvt 12 to /etc/rc.local (see this U&L post).

Special buttons like the power button might still be a cause for concern.


On second thought, other key combinations are available:

  • if the virtual console is not running X, then the CtrlAltFx can be used without Ctrl - just AltFx would work.
    • Alt+ arrow keys can also be used to switch to the previous and next VTs
    • CtrlAltDel triggers a reboot in any of the VTs not running X.

So a better solution might be running an empty X session (not running any other application) in VT12 to cut down the number of available key combinations and switching to it.

startx -- :100 vt12 &
chvt12

This needs to be tested (you might need to write an .xinitrc to override the defaults).

Solution 2:

You can to the same by pressing

Ctrl+Alt+L

This will lock the screen and require the password to unlock it.