Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I disable switching to virtual terminals (TTYs) using(Ctrl+Alt+F1...F6) in Ubuntu?

share|improve this question
I guess you should take a look at this answer to How can I reduce the number of TTYs? – arsaKasra Oct 12 '13 at 7:40
@arsaKasra: Thanks – Maythux Oct 12 '13 at 7:45
Out of curiosity, why do you want this? I've got a set of ill-behaved init-scripts that have somehow disabled these and am trying to restore them! – Kyle Strand Mar 12 at 0:32

Open/create the file /etc/X11/xorg.conf using the following command:

sudo -i gedit /etc/X11/xorg.conf

and add the following lines inside:

Section "ServerFlags"
    Option "DontVTSwitch" "true"

Source: [all variants] How to disable CTRL ALT F1 -

share|improve this answer
Note that once in a while, when X11 gets stuck, those keys allow you to get out to a console and cleaning shutdown your system... I used that many times although these days I have a lot less problems with X11 getting stuck! – Alexis Wilke Oct 12 '13 at 8:02
up vote 11 down vote accepted

I found three methods. I'm listing to help others if they need:

First Method:

sudo tee -a /etc/init/tty{1..6}.override <<<"manual"

Second Method:

Open/create the file /etc/X11/xorg.conf using the following command:

sudo -i gedit /etc/X11/xorg.conf

and add the following lines inside:

Section "ServerFlags"
    Option "DontVTSwitch" "true"

Third Method:

sudo -i

vi /etc/default/console-setup

change ACTIVE_CONSOLES="/dev/tty[1-6]" to your choice. Lets say if you want only two TTY or virtual console then change to ACTIVE_CONSOLES="/dev/tty[1-2]"

cd /etc/event.d

Comment on all the lines in ttyX file that you don't need. In this example tty3-tty6 Reboot to see the change.

share|improve this answer
2nd method works on elementaryOS Freya (Ubuntu 14). Thanks. – Hoang Tran Jul 11 at 7:15
sudo rm /etc/init/tty*.conf

This will totally remove the tty* conf file and thus you will not be able to use it :)

NB: you can't be able to restore it later on

share|improve this answer

open the tty conf in the /etc/init/ directory

comment out those lines in the ttyX.conf files:

#exec /sbin/getty -8 38400 ttyX

Example to disable tty1:

sudo -H gedit /etc/init/tty1.conf

Then edit by inserting # in front of the commands

#exec /sbin/getty -8 38400 tty1

Save and Reboot

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.