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/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
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
Disable TTY terminal console
To disable tty terminal make the below changes in
ReserveVTTakes a positive integer. Identifies one virtual terminal that shall unconditionally be reserved for
autovt@.serviceactivation . 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 "
ReserveVT. With this step you have disabled all the available terminals. Now you can manually enable the required terminals.
xorgprocess 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
node1:~ # ln -sf /usr/lib/systemd/system/getty@.service /email@example.com
node1:~ # ln -sf /usr/lib/systemd/system/getty@.service /firstname.lastname@example.org
Enable tty using systemctl:
node1:~ # systemctl enable email@example.com
node1:~ # systemctl enable firstname.lastname@example.org
Verify the changes
node1:~ # ls -l /email@example.com lrwxrwxrwx 1 root root 38 Jun 1 15:23 /firstname.lastname@example.org -> /usr/lib/systemd/system/getty@.service
node1:~ # ls -l /email@example.com lrwxrwxrwx 1 root root 38 Jun 1 11:49 /firstname.lastname@example.org -> /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.