For example, in X session, I can use Ctrl–Alt–L to lock the screen, so it would ask for password to unlock and prevent somebody from messing with mine computer.
But if I have an open terminal session on one of the tty’s (which I can access with Ctrl–Alt–F1, for example) – then it is not locked, and somebody can still use it to do some harm. Is there a way to ‘lock’ that command line (with some background processes running in it, maybe)?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
vlock will do as you ask. However, if you want to run background processes, consider screen instead, which will let you also log off and keep processes running in the background, and then reattach — even when logged in from alternate places.
Method 2
If you run screen in the terminal, you can lock the terminal with the command Ctrl–a x.
Method 3
Check out “binarix”. It will lock your Terminal. No need for X or screen.
http://raffi.at/view/code/binarix
Method 4
I couldn’t get vlock to work un osx, so I created a simple shellscript alternative.
https://github.com/acornejo/bashlock
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0