If you have moved away from your computer, lock it to protect it from strangers. To make the lock effective, set a password. You can then lock your computer by pressing ⊞ Win + L (Windows) or Ctrl + ⇧ Shift + Power (Mac OS). Remember that such a solution is not the crown of security, but it will prevent unauthorized people from accessing your computer.
Steps
Method 1 of 2: Windows

Step 1. Open Windows Settings
Press ⊞ Win and select Options.
On older versions of Windows, open the Control Panel; to do this, press ⊞ Win and select "Control Panel". If there is no Control Panel in the list that opens, enter "Control Panel" (without quotes) in the search bar and click on the corresponding entry in the search results

Step 2. Click on Accounts
This button is on the right side of the Options page; Account settings will open.
- On older versions of Windows, click User Accounts.
- In Windows 10 and 8, users are required to create a password when creating accounts. In older versions, click on "Make Account Changes" - "Create Password" (next to your current account).

Step 3. Click on Login Options
This button is in the left sidebar; a new page with settings will open.

Step 4. In the drop-down menu of the "Prompt for password" section, select "When you wake up from sleep mode"
This menu is at the top of the page.

Step 5. Create a PIN (if you want)
In the "Pin Code" section, click "Add". You need to enter the password for the account, and then enter the PIN code twice (a second time for confirmation).
- The PIN includes numbers only.
- A PIN is used instead of a password when logging in or unlocking the computer.

Step 6. Press ⊞ Win + L
This will block your computer. To unlock it, you need to enter a password or PIN.
- Set the time after which the monitor automatically enters standby mode (that is, is locked). To do this, click "Options" - "System" - "Power and Sleep". Select the appropriate time from the drop-down menu of the "Display" section. Please note that in the case of a laptop, the time must be set two times: for the "On line" mode and the "On battery power" mode.
- If the computer goes into sleep mode, it locks up. To set the time after which the computer automatically goes into sleep mode, click on "Settings" - "System" - "Power & Sleep" and open the menu under "Sleep".
Method 2 of 2: Mac OS

Step 1. Open System Preferences
To do this, open the Apple menu (top left corner) and click System Preferences.
- You can also open system preferences through Launchpad or the Quick Launch bar (at the bottom of the screen).
- In recent versions of OS X, the user is required to create a password. To create a password in older versions, in the system settings window, click "Accounts" - "Change password" (next to the user account).

Step 2. Click on Security & Privacy (in the top row of options)

Step 3. Go to the "General" tab
The tabs are located at the top of the window.

Step 4. Click on the lock-shaped icon (located in the lower left corner)
You will be prompted for a password. After entering the password, you will have full access to the system settings.

Step 5. Check the box next to "Prompt for password when entering sleep or standby mode"
Now the system will ask for a password after a certain time after the computer / monitor goes into sleep / standby mode.

Step 6. Select "Immediately" from the drop-down menu
This menu is located next to the checkbox. Now the system will ask for a password immediately after the computer / monitor goes into sleep / standby mode.
In the corresponding drop-down menu, you can set the time after which the password will be requested. This is useful if you want to quickly wake up the monitor without entering a password. But the "Immediate" option is considered the most effective for the security of the computer

Step 7. Activate the "Disable automatic login" option (in OS X 10.9 and earlier)
Automatic login eliminates the need to enter a password when booting the system and waking up from sleep mode. If you disable automatic login, you will be prompted for a password when exiting hibernation and standby modes.
- This option is not available for the administrator account in OS X 10.10 and later.
- If you want, click on the padlock icon to block the ability to make changes to the settings (they will be saved anyway).

Step 8. Press Ctrl + ⇧ Shift + Power
The monitor will go into sleep mode, but the computer will not go into sleep mode. To unlock the monitor, you need to enter a password.
If your Mac has an optical drive, press Ctrl + ⇧ Shift + ⏏ Eject to do the same
Advice
- Press any key on the keyboard or move the mouse to wake up the monitor and unlock the computer.
- Use a strong password to keep your computer as secure as possible.
- In Mac OS, you can use hot corners to activate the screensaver (and lock the monitor if the system is configured as described above). Open System Preferences and click Desktop & Screensaver - Screensaver - Hot Corners. In the drop-down menu of the desired corner, select "Screensaver". Now, when you move the cursor to this corner, the screensaver will be activated.