I took a practice test for a cert and one of the questions was "Limit root to no more 2 simultaneous logins, make this configuration persistent between restarts". I didn't even really know this was possible. Is this just for ssh or could you do this for all terminal access on the machine? If so, how?
One way would be to limit the terminals through which root login is allowed. This is done by editing
/etc/securetty
. Just letsecuretty
contain any two TTYs and you're done.You can edit
/etc/security/limits.conf
and add:root hard maxlogins 1
This will limit the total number of root login shells to 1, and it includes both local and remote access.
Nevert tried this but would go the following way:
bin/bash
and other shells unaccessible to root.