Require a password when resuming
Password protect your Mac when it goes to sleep or when the screen saver begins.
Go to Apple > System Preferences and click Security & Privacy.
Make sure the General tab is selected.
Check the Require password box.
Select how soon after your Mac goes to sleep, or the screen saver begins. It’s a good idea to choose Immediately, especially in a public place, or anywhere there are other people around.
You will be able to wake the computer with your local password.