6

I am running Ubuntu from a live session in order to see if I can reproduce this bug. Since though I'm still supposed to get stuff done, I'm trying to also do that. As a result I have to log onto corporate resources, and lock my screen while I'm not at my desktop.

I set a password on the default ubuntu/999 user account, but Ctrl-Alt-L still does not lock the screen, it merely blacks out the monitor.

How can I have a proper screen lock? Maybe I should just install xscreensaver...

2
  • I feel that the fact that I happened to be running Ubuntu+1 here is in no way relevant to the question, or the answer I have provided, since all supported versions of Ubuntu are equally incompatible with xscreensaver.
    – badp
    Feb 25, 2016 at 16:04
  • 1
    @DnrDevil That's true, however the issue is also present in Ubuntu 14.04 and Ubuntu GNOME 15.10, so it's not specific to Xenial or due to a bug, it's just how the Live session works.
    – kos
    Feb 25, 2016 at 16:23

2 Answers 2

9

On Ubuntu 12.04 & above with Unity/GNOME, you can enable locking the screen with the following command:

gsettings set org.gnome.desktop.lockdown disable-lock-screen false

However without a password it may not even work or be able to login i would recommend adding a user as well first just in case.

2
  • Also under System SettingsSecurity & PrivacySecurityRequire my password when, check Returning from blank screen
    – badp
    Feb 25, 2016 at 16:20
  • 1
    Answer still relevant for Ubuntu 18.10 LiveUSB. Enable automatic lock when screen turn off in Settings > Privacy > Screen lock. Don't forget to set a password, also in Settings > Details > Users > Password
    – solsTiCe
    Nov 9, 2018 at 21:31
1

Probably not optimal, but it worked.

  1. Set up a password from the terminal (the graphical interface didn't work for me, but ymmv).

    passwd
    
  2. Open Software & Updates and enable all repositories.

  3. Install xscreensaver.

    sudo apt-get update
    sudo apt-get install xscreensaver
    
  4. Launch the xscreensaver demon. This also opens up a window.

    xscreensaver
    
  5. Click on Settings and tick Lock Screen After. Set your timeout.

  6. Open System SettingsKeyboardShortcuts, and add this shortcut:

    xscreensaver-command -lock
    

    Assign to it the key combination of your choice; it's fine to override ctrl-alt-l.

1
  • worked on Linux Mint 20.2. have not tested on original Ubuntu, maybe will. Other answer gsettings set org.gnome.desktop.lockdown disable-lock-screen false had seemingly no effect. Interestingly answer dm-tool lock from askubuntu.com/questions/1242110/… worked kind of (locked the screen but could be circumvented by switching to other tty and on returning back screen was not locked). May 4 at 16:04

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.