Linux Secure Attention Key (SAK) handling

Peios: Changing the SAK key requires CAP_SYS_ADMIN, which maps to enabled SeTcbPrivilege, in addition to the applicable terminal access checks. See Peios kernel behaviour.

Date: 18 March 2001

Author: Andrew Morton

An operating system's Secure Attention Key is a security tool which is provided as protection against trojan password capturing programs. It is an undefeatable way of killing all programs which could be masquerading as login applications. Users need to be taught to enter this key sequence before they log in to the system.

From the PC keyboard, Linux has two similar but different ways of providing SAK. One is the ALT-SYSRQ-K sequence. You shouldn't use this sequence. It is only available if the kernel was compiled with sysrq support.

The proper way of generating a SAK is to define the key sequence using loadkeys. This will work whether or not sysrq support is compiled into the kernel.

SAK works correctly when the keyboard is in raw mode. This means that once defined, SAK will kill a running X server. If the system is in run level 5, the X server will restart. This is what you want to happen.

What key sequence should you use? Well, CTRL-ALT-DEL is used to reboot the machine. CTRL-ALT-BACKSPACE is magical to the X server. We'll choose CTRL-ALT-PAUSE.

In your rc.sysinit (or rc.local) file, add the command:

echo "control alt keycode 101 = SAK" | /bin/loadkeys

And that's it! Only the superuser may reprogram the SAK key.

Edit this page