If you need to lock your account without log out, you can use ‘vlock’, a very simple-to-use utility to lock virtual consoles.

Install vlock. Then, to lock your current virtual console, just type vlock.

This TTY is now locked.

Please press [ENTER] to unlock.

To unlock you will need to type your password. You can lock all your consoles with vlock -a (you won’t be able to change console with Ctrl + Alt + F buttons, but this won’t work on SSH sessions or terminal emulators):

The entire console display is now completely locked.
You will not be able to switch to another virtual console.

Please press [ENTER] to unlock.

If you have any suggestion, feel free to contact me via social media or email.