How to enable tty for more than 6 console. How to disable all the tty terminals in Linux. systemd disable tty. systemd enable tty using getty service in Linux.

I have written another article to understand the difference
between /dev/tty and /dev/pts. In this
article I will share the steps to disable tty and enable tty for
specific terminal consoles in Linux.
Basic overview on TTY
- tty consoles are managed by systemd in Red Hat Enterprise Linux 7 OS.
- tty consoles are created on-the-fly upon access.
- The allowed number of consoles can be configured in
/etc/systemd/logind.conffile. - Set
NAutoVTs=value in this file to desired number to have systemd capable of generating those many tty consoles. - By default there are 6 terminals available on a Linux system which can
be accessed using
Ctrl+Alt+F[1-6]
Disable TTY terminal console
To disable tty terminal make the below changes in
/etc/systemd/logind.conf
NAutoVTs=0
ReserveVT=N
ReserveVT Takes a positive integer. Identifies one virtual terminal
that shall unconditionally be reserved for autovt@.service activation
. The VT selected with this option will be marked busy unconditionally,
so that no other subsystem will allocate it. This functionality is
useful to ensure that, regardless of how many VTs are allocated by other
subsystems, one login “getty” is always available.
Now since our aim is to disable all the terminals, we will leave the
value as “N” for ReserveVT. With this step you have disabled all the
available terminals. Now you can manually enable the required terminals.
xorg process and it is
hardcoded.
Enable TTY terminal console
For the demonstration of this article I will enable console access for terminal 2 and 3 on my Linux host.
Create a symlink of a tty you want to enable in
/etc/systemd/system/getty.target.wants.
node1:~ # ln -sf /usr/lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty2.service
node1:~ # ln -sf /usr/lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty3.service
Enable tty using systemctl:
node1:~ # systemctl enable getty@tty2.service
node1:~ # systemctl enable getty@tty3.service
Verify the changes
node1:~ # ls -l /etc/systemd/system/getty.target.wants/getty@tty2.service
lrwxrwxrwx 1 root root 38 Jun 1 15:23 /etc/systemd/system/getty.target.wants/getty@tty2.service -> /usr/lib/systemd/system/getty@.service
node1:~ # ls -l /etc/systemd/system/getty.target.wants/getty@tty3.service
lrwxrwxrwx 1 root root 38 Jun 1 11:49 /etc/systemd/system/getty.target.wants/getty@tty3.service -> /usr/lib/systemd/system/getty@.service
Next reboot the node to activate the changes
node1:~ # reboot
Once the node is successfully UP post reboot, attempt to connect to
other terminals using Ctrl+Alt+F[4-6] and you will observe that all
these terminals will be disabled although terminal 1-3 will be enabled
because of our configuration.
Lastly I hope the steps from the article to enable or disable tty on Linux was helpful. So, let me know your suggestions and feedback using the comment section.


