lock(1)

lock1

Reserve a terminal

Usage

lock [-np] [-a style] [-t timeout]

Overview

lock requests a password from the user, reads it again for verification and then will normally not relinquish the terminal until the password is repeated.

The options are as follows:

-a style

The specified BSD Authentication login style (as specified in /etc/login.conf) will be used to authenticate the user. If the particular style requires a challenge/response handshake or a special prompt, the user may enter the name of the style to get the standard prompt for that style.

-n

Lock the terminal forever. This overrides -t and is the default on OpenBSD unless -t is specified.

-p

A password is not requested, instead the user's current login password is used. If the user has an S/Key key, they may also use it to unlock the terminal. To do this the user should enter "s/key" at the unlock “Key:” prompt. The user will then be issued an S/Key challenge to which they may respond with a six-word S/Key one-time password.

-t timeout

Unlock the terminal after timeout minutes unless -n is also specified. When used in this manner lock should be invoked so that the user is safely logged out if the timeout elapses:

$ lock -t 15 || exit

Releases

61 releases since OpenBSD 2.1; the text changed 12 times.

  1. 2.1–2.3
  2. 2.4
  3. 2.5
  4. 2.6
  5. 2.7–2.8
  6. 2.9
  7. 3.0–3.3
  8. 3.4–3.7
  9. 3.8–4.1
  10. 4.2–5.0
  11. 5.1–5.4
  12. 5.5–6.5
  13. 6.6–8.0

-a since OpenBSD 3.0.

History

The lock command first appeared in 2BSD.

Authors

Kurt Shoens.

From man 8.0-current-20261101 in OpenBSD 8.0-current (2026-11-01). Parsed by carta from the page's mdoc source.