Ubuntu – How to disable Virtual Consoles tty[1-6]

tty

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

Best Answer

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.