How to prevent my screens from turning off, when the screen is locked?

Open your System Settings. We need to make changes to Power and Brightness & Lock settings.

System Settings

Power Settings

Change the value of Suspend when inactive for to Don't suspend.

Power Settings

Brightness & Lock Settings

Change the value of Turn screen off when inactive for to Never.

Brightness & Lock Settings

This should help to achieve your desired result.


I had to install additional screensaver program XScreenSaver and use it instead of default one because accepted answer had no effect for me on Ubuntu 16.04 and 17.10.

  1. Install XScreenSaver:

    sudo apt install xscreensaver
    
  2. Add this command to Startup Applications:

    xscreensaver -nosplash
    
  3. Disable default Super+L shortcut

    • Install CompizConfig Settings Manager

      sudo apt install compizconfig-settings-manager
      
    • Launch it and click "Ubuntu Unity Plugin"

    • Click the button next to "Key to lock the screen."
    • Disable
  4. Add this command to enable Super+L shortcut for XScreenSaver in System Settings > Keyboard > Shortcuts > Custom Shortcuts

    xscreensaver-command -lock