If I suspend my Xubuntu 12.10, and then take my computer off the suspension, it doesn't request any password. I have tried adding the gnome-screensaver on autostart settings, which I read somewhere (go to settings manager>sessions and startup>application autostarts>add [gnome-screensaver]), but that doesn't work.

How can I make my xubuntu request a password after suspension?


In Xubuntu 12.10, session is no longer locked when you Suspend, so it doesn't ask for a password on wakeup. To solve this, we need to make changes to xfce4-session and xfce4-power-manager.

Using Terminal Commands

Run the following commands in terminal (press Ctrl + Alt + T) to make changes to both xfce4-session and xfce4-power-manager to lock the session when you Suspend:

xfconf-query -c xfce4-session -p /shutdown/LockScreen -s true
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/lock-screen-suspend-hibernate -s true

Alternatively — Using GUI

We need to make changes in both Session and Startup as well as Xfce Power Manager.

You would find both of them to be available under Settings Manager. Right Click on your Desktop and navigate through ApplicationsSettingsSettings Manager to open it.

xubuntu settings manager navigation

  1. Session and Startup

    Open Session and Startup → navigate to the Advanced Tab → put a checkmark next to Lock screen before sleep.


  2. Xfce Power Manager

    Open Xfce Power Manager → click on Extended in the sidebar → put a checkmark next to Lock screen when going for suspend/hibernate.


Once you have made the changes, you should be asked for the password when you wakeup after Suspend.

Acknowledgement: Information and images for Session and Startup and Xfce Power Manager courtesy this Ubuntu Forums Thread.

  • 2
    The first didn't work, because it said the file didn't exist and I had to create is using the --create option, but the second option (GUI) did work! Thanks so much! – Martinio Feb 21 '13 at 15:22

I would like to add to this...

A key component is that light-locker must be running in order for screen locking to work! I was stuck on this for a while, because the answers provided were not working for me, which didn't make any sense. Then I tried fiddling around with light-locker for a bit and realized that it wasn't set to run automatically on startup (thus, screen locking was not working in general, not just on suspend). Upon re-enabling light-locker from startup, these solutions worked :-)

Long story short: if these solutions aren't working for you, go to whisker menu --> settings --> session and startup --> application autostart, and make sure that "screen locker" is ticked.

  • 2
    Clearly one of the most important part of the answer, it solved it for me. – Doodloo May 12 '16 at 9:36

I solved this with a script, tied to keyboard shortcut: CTRL+SUPER+DELETE.

Create the script in /usr/local/bin, and call it something like lock_and_suspend:

$ sudo gedit /usr/local/bin/lock_and_suspend

Here's the script:


xscreensaver-command -lock
sleep 2
xfce4-session-logout --suspend

Update its permissions:

$ sudo chmod a+x /usr/local/lock_and_suspend
$ sudo chmod 711 /usr/local/lock_and_suspend
$ sudo chown yourusername /usr/local/bin/lock_and_suspend

And run it by simply typing lock_and_suspend at the command line. Or tie lock_and_suspend to a keyboard shortcut with SettingsManager > Keyboard > Application Shortcuts.

It works by simply locking the screen before suspending the system. The sleep command is necessary because the screenlock needs time to take effect. Suspend will stop it before it has finished if there is no pause between them.

You may need to install xscreensaver. The screenlock is usually executed by xlock4. But xlock4 just cycles through possible screenlockers such as xscreensaver and selects the one that works. I don't remember precisely why I did this. Suffice to say that it did not work when I attempted to lock the screen using xflock4 (using its default keyboard shortcut of CTRL+ALT+DEL) before suspending the system.

Anyway, the point is that you actually to do three things: lock screen, suspend system, close lid. And from experience, you want to make sure the system is locked and suspended before closing the lid, because it's often been the case that when you rely on some setting to lock and suspend when you close the lid, it sometimes fails, and you've no way of checking without opening the lid. But since opening the lid wakes the system from suspend, how do you know if it had suspended? (It's a case of Schrödinger's cat. Or Fourdan's mouse). The only way to be sure is you lock and suspend the system before closing the lid. And the only convenient way to do this is with a single keyboard shortcut (CTRL+SUPER+DEL).

You might need to close backdoors to xscreensaver screenlock.

At some point I may have installed light-locker, and configured it to lock the screen. I don't remember if this was actually necessary.

$ sudo apt install light-locker
$ xfconf-query -c xfce4-session -p /general/LockCommand -s "light-locker-command --lock" --create -t string

It might also be necessary to enable xscreensaver and power manager in Settings > Sesstion and Startup > Application Autostart. And perhaps to uninstall / disable gnome-screensaver.

You might want to install xfce4-power-manager, and to configure it (using settings manager or xfce4-power-manager --customize) to 'suspend', 'when laptop lid is closed'. In that case, you might need to configure power manager to handle the lid close event properly. But I was inclined to lock+suspend before closing the lid.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.