Lock Ubuntu Server 12.0.4

Solution 1:

vlock does the trick.

apt-get install vlock.

Solution 2:

If you mean a basic X screen, you could install and run xlock to accomplish screen lock. If you mean in a virtual terminal, then you need to just logout, with Ctrl+D, or running the exit command. If you need to keep some processes running while logged out, you should look at using byobu, tmux (which byobu uses for the terminal management), or screen.