When I switch to VT 9 by pressing Ctrl+Alt+F9 I get a root shell by default without a password prompt. How can I change it to demand a password before giving root shell access? I am using Ubuntu 16.04 LTS.
In Sergiy's answer he has explained the methods to open VTs with and without sudo and includes description of device files of VTs but he has not addressed this problem of mine where I have a default root shell on VT9.
Output of lsof /dev/tty9
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
Output information may be incomplete.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
bash 281 root 0u CHR 4,9 0t0 28 /dev/tty9
bash 281 root 1u CHR 4,9 0t0 28 /dev/tty9
bash 281 root 2u CHR 4,9 0t0 28 /dev/tty9
bash 281 root 255u CHR 4,9 0t0 28 /dev/tty9
Output of systemctl status getty@9
● getty@9.service - Getty on 9
Loaded: loaded (/lib/systemd/system/getty@.service; enabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:agetty(8)
man:systemd-getty-generator(8)
http://0pointer.de/blog/projects/serial-console.html