15

I have just installed tmux and vlock. When I try to perform the lock-session command, my terminal flashes and then nothing happens. Is there something in my .tmux.conf that must be added to tell tmux that I have a locking utility? If so, what is it?

In other words:

How can I do lock-session with tmux?

kzh
  • 866
  • 2
  • 10
  • 23

2 Answers2

13

Put the following in the .tmux.conf:

set-option -g lock-command vlock
kzh
  • 866
  • 2
  • 10
  • 23
  • Just in case, the package/program `vlock` may not be installed by default (e.g.`Ubuntu 20.04.5 LTS`). The following, usually, should achieve it: `sudo apt-get install vlock;`. – Artfaith Dec 09 '22 at 09:20
4

I have the following tmux.conf lines:

# Enable locking
set -g lock-command vlock
set -g lock-after-time 0 # Seconds; 0 = never
bind L lock-session

Pressing [prefix] + L (capital) locks my session.

Related How can I lock just the current client?

Tom Hale
  • 3,358
  • 5
  • 16
  • 33