lock -- lock a user's terminal


lock [ -v ] [ -number ]


The lock command requests a password from the user, requests it again for verification, then locks the terminal until the password is reentered. If a -number is specified in the lock command, the terminal is automatically logged out and made available to another user after that number of minutes has passed.

This command uses the file /etc/default/lock. This file has two entries:

DEFLOGOUT = number
MAXLOGOUT = number

DEFLOGOUT specifies the time in minutes that a terminal will remain locked before the user is logged out. The default value is set to 30 minutes; this is overridden if the -number option is used on the command line. If DEFLOGOUT and -number are not specified, the MAXLOGOUT value is used.

MAXLOGOUT is the maximum number of minutes a user is permitted to lock a terminal. The default value is 60 minutes. If a user attempts to lock a terminal for longer than this time, lock will issue a warning to the user that it is using the system maximum time limit. If DEFLOGOUT and -number and MAXLOGOUT are not specified, users are not logged out.

DEFLOGOUT and MAXLOGOUT are configured by the system administrator to reflect the demand for terminals at the site.

The lock may be terminated by killing the lock process. Only the super user and the user who invoked lock may do so.

The -v option specifies verbose operation.


lock will not log you out when the lock time limit expires if your login shell allows job control (for example, ksh(C)). In such a case, the terminal may display a shell prompt. This may result in another unauthorized user being able to access your account.


If you call lock using a shell escape from within an application program, you may lose data if the application cannot handle receiving a SIGHUP signal when lock times out.

lock will not lock screens other than the current one if multiscreens are being used (see also mscreen(M) and multiscreen(M)). lock is also ineffective on X terminals for similar reasons; use scolock(XC) instead.


file containing default lock values

See also


Standards conformance

lock is not part of any currently supported standard; it is an extension of AT&T System V provided by The Santa Cruz Operation, Inc.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005