The screen is locked after some time. That is ok. Then some minutes or hours later I come back. Sometimes I want to get in again, then I need to log in. But sometimes I just want to send the machine to sleep or to halt it right away. I want to do these without first logging in.
I disconnect the display in this case for sleep if I can't remember the shortcuts that I don't use often.
- Option–Command–Power button* or Option–Command–Media Eject : Put your Mac to sleep.
- Control–Shift–Power button* or Control–Shift–Media Eject : Put your displays to sleep.
For shut down, you can also log in - either via screen sharing, ssh, Apple a Remote Desktop or remote scripts if you need to sleep or power off the display and haven't memorized the commands above.