A perhaps easier method of user1709672's response is to open terminal (
T), and type this:
sudo apt install unity-tweak-tool
Once installed, open it by locating it in your application menu of choice by searching "Unity Tweak tool" (or from terminal/Alt-F2 box by typing
unity-tweak-tool). Then, click the security button (I think it defaults to look like a little castle with marbles bouncing away from it), and make sure the "Disable Screen Lock" and perhaps "Disable User Switching"/"Disable User Log Out" options are unchecked. If there's a "Disable Display Sleep" option on yours, uncheck that as well.
If non are checked, perhaps try checking and unchecking each one (sometimes, when this program goes in to change the configs, it can overwrite a mistakenly changed one, and then changing it back gets you to the target config).
Restart and see if this works. Also, try manually inducing the lock window with