42

I don't remember why they did this, but at one point X.org decided that disabling CtrlAltBackspace to kill it was a good idea. I know there's a way to re-enable it but I don't remember how. Can someone refresh my memory?

tshepang
  • 65,642
xenoterracide
  • 59,188
  • 74
  • 187
  • 252

7 Answers7

33

Modify /etc/X11/xorg.conf or a .conf file in /etc/X11/xorg.conf.d/ with the following. (note: it is ok if this is all you have in your xorg.conf as xorg will still auto-detect the rest (note: that is if auto-detect works for you without it))

Section "ServerFlags"
    Option "DontZap" "false"
EndSection

Section "InputClass" Identifier "Keyboard Defaults" MatchIsKeyboard "yes" Option "XkbOptions" "terminate:ctrl_alt_bksp" EndSection

xenoterracide
  • 59,188
  • 74
  • 187
  • 252
  • 5
    They seriously disabled this by default? No wonder it hasn't been working! – gabe. Aug 13 '10 at 18:47
  • yes and it happened like 5 years ago. – xenoterracide Aug 13 '10 at 18:54
  • 9
    When you don't have to zap your xwindows very often, sometimes its easy to miss a change that happened 5 years ago... – Astra Aug 16 '10 at 20:08
  • @Redbeard eh... xorg (and drivers) and kwin have been doing enough screwing around that I occasionally have to do it, and half the time I find out it's been disabled and I haven't re-enabled since my last reinstall. – xenoterracide Aug 17 '10 at 18:30
  • 4
    @gabe. It's disabled by default because it's a potential security risk. For example, say the user logs in to the bare shell, starts X with startx, does some work, then locks the screen with xlock and leaves. Anyone can come along, zap X and get access to the user's shell on the tty. – amphetamachine Nov 21 '11 at 21:59
  • I think you can still do about the same thing with Alt-PrintScrn-K. – elias Feb 27 '13 at 13:32
  • 4
    In some distributions (e.g. recent Fedoras) these kinds of additional settings should probably be placed in /etc/X11/xorg.conf.d as a conf file, e.g. 10-enable-ctrl-alt-backspace. – Tommi Kyntola Jan 07 '14 at 12:43
  • any of these files/dirs not found on my Ubuntu 20.10 system: ❱ ls /etc/X11/ app-defaults rgb.txt Xresources XvMCConfig cursors xinit Xsession Xwrapper.config default-display-manager xkb Xsession.d default-display-manager.dpkg-tmp Xreset Xsession.options fonts Xreset.d xsm – crysman Mar 13 '21 at 21:49
12

The DontZap feature is no longer working for me on Fedora 16 and Ubuntu 11.10 (most recent releases as of November 2011), so I found an alternative.

According to the X11R7.5 release notes, it appears that this functionality has been migrated to a XKB configuration option, therefore DontZap no longer works. I can't tell if this is a detail of the Xorg implementation in Fedora and Ubuntu, or if this affects other distros as well.

From http://www.x.org/archive/X11R7.5/doc/RELNOTES.txt

Terminate Server keystroke

The Xorg server has previously allowed users to exit the server by pressing the keys Control + Alt + Backspace. While this function is still enabled by default in this release, the keymap data usually used with Xorg, from the xkeyboard-config project, has been modified to not map that sequence by default, in order to reduce the chance that inexperienced users will accidentally destroy their work.

Users who wish to have this functionality available by default may enable it via the XKB configuration option “terminate:ctrl_alt_bksp”. For instance, the setxkbmap command can be used to enable this by running:

       setxkbmap -option "terminate:ctrl_alt_bksp"                       

Many desktop environments include XKB configuration options in their preferences to enable this as well.

Stefan Lasiewski
  • 19,754
  • 24
  • 70
  • 85
  • 1
    my answer still works as of 7.6 – xenoterracide Nov 22 '11 at 07:01
  • 1
    Thanks for this answer. I prefer this option because it allows users to enable this feature without being root or having to modify system-wide configuration files. This command worked for me in Fedora 22. – crayzeewulf Nov 08 '15 at 18:42
  • The only reason I disagree with this option, is you can't kill the login manager, and if your "boot" into your desktop environment gets stuck, you can't kill it there. I recently had this problem. – xenoterracide Jan 21 '21 at 16:33
10

In current Ubuntu releases, at least since 14.10, the keyboard-configuration package has an option to re-enable Zap:

$ sudo dpkg-reconfigure keyboard-configuration
guest
  • 101
  • 1
  • 2
9

With debian or based on, you can add this option :

XKBOPTIONS="terminate:ctrl_alt_bksp"

to /etc/default/keyboard file

lolotux
  • 131
4

you can try following ( I have tried it on my Ubuntu) :

Add the following lines to your xorg.conf file, making sure that when you paste it, it is NOT using smart quotes.

sudo gksudo gedit /etc/X11/xorg.conf

Section "ServerFlags"
Option "DontZap" "false"
EndSection

you can also try dontzap tool

sudo apt-get install dontzap

Open Terminal and type to enable

sudo dontzap --enable

for disable

sudo dontzap --disable

manatwork
  • 31,277
Hemant
  • 6,910
  • 5
  • 39
  • 42
  • I really wish they had never turned this off by default.

    oh, and apt-get doesn't work on my system ;) apparently we haven't packaged dontzap either. oh well.

    – xenoterracide Aug 12 '10 at 07:20
  • did you try first solution ? – Hemant Aug 12 '10 at 07:28
  • setxkbmap -option terminate:ctrl_alt_bksp

    by itself that didn't work :( apparently you need to do this too.

    – xenoterracide Aug 12 '10 at 07:29
  • @Hermant of course but it seems to be only 1/2 of it. I actually have it working now... there's a way to configure the xsetkbd option in xorg.conf. like so Section "InputClass" Identifier "Keyboard Defaults" MatchIsKeyboard "yes" Option "XkbOptions" "terminate:ctrl_alt_bksp" EndSection there are several other places it could be done too. – xenoterracide Aug 12 '10 at 09:55
  • It will be gr8 if you can put your solution as Answer. So that others facing same issue can get help :-). – Hemant Aug 12 '10 at 10:06
  • @Hemant I did... I was giving you a chance to modify yours ;) – xenoterracide Aug 13 '10 at 18:54
  • @xenoterracide: opps I missed it :-). thanks for chance. – Hemant Aug 13 '10 at 19:24
1

@xenoterracide's solution is ok if the AutoAddDevice option is enabled in the ServerLayout of your xorg.conf. If not (especially in multiseat X configurations), you need to insert the XkbOptions line into the InputDevice section describing your keyboard. For example:

Section "InputDevice"
  Identifier  "keyboard-vmware"
  Driver      "evdev"
  Option      "Device" "/dev/input/by-path/platform-i8042-serio-0-event-kbd"
  Option      "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection
peterh
  • 9,731
0

In RHEL 7.3, xenoterracide's answer worked for me, with one tweak: the path to the config file is /etc/X11/xorg.conf.d/00-keyboard.conf.

sebasth
  • 14,872
Tyler R.
  • 121