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
1  
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"
EndSection

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

share|improve this answer
8  
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"
EndSection

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:

#respawn 
#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

#respawn 
#exec /sbin/getty -8 38400 tty1

Save and Reboot

share|improve this answer

Your Answer

 
discard

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.