How can I block a normal user on a Ubuntu/Redhat from logging in via the serial console (ttyS0
) without blocking root ?
Only root needs console access, no other users.
I have cleared /etc/securetty
, can anyone suggest the right method ?
How can I block a normal user on a Ubuntu/Redhat from logging in via the serial console (ttyS0
) without blocking root ?
Only root needs console access, no other users.
I have cleared /etc/securetty
, can anyone suggest the right method ?
I suggest using PAM to set these restrictions. Most likely, you’ve got a file called /etc/pam.d/login, which is used by the login process spawned by getty running on ttyS0.
It probably includes one of the generic authentication files, so you could just block anything with a uid > 0 in that.
You could also use pam_access access.conf to limit just root for ttyS0.
Something to clear up first so that we can arrive at the correct solution and not what you are trying to do:
sudo command
or become root with sudo -i
. This implies that logging as root on the serial console is impossible and should stay that way.If you want root login without sudo
just in case your /home
is broken then you probably have a couple of other problems also. In that case I would suggest booting from a live-medium, that way you can also give yourself all necessary permissions to fix the problem(s).