This method immediately detects superuser attempts to access the local system.
View the CONSOLE entry in the /etc/default/login file.
CONSOLE=/dev/console |
By default, the console device is set to /dev/console. With this setting, root can log in to the console. root cannot log in remotely.
Verify that root cannot log in remotely.
From a remote system, try to log in as superuser.
mach2 % rlogin -l root mach1 Password: <Type root password of mach1> Not on system console Connection closed. |
Monitor attempts to become superuser.
By default, attempts to become superuser are printed to the console by the SYSLOG utility.
In this example, superuser attempts are not being logged by SYSLOG. Therefore, the administrator is logging those attempts by removing the comment from the #CONSOLE=/dev/console entry in the /etc/default/su file.
# CONSOLE determines whether attempts to su to root should be logged # to the named device # CONSOLE=/dev/console |
When a user attempts to become superuser, the attempt is printed on the terminal console.
SU 09/07 16:38 + pts/8 jdoe-root |
To become superuser from a remote system when the /etc/default/login file contains the default CONSOLE entry, users must first log in with their user name. After logging in with their user name, users then can use the su command to become superuser.
If the console displays an entry similar to Mar 16 16:20:36 mach1 login: ROOT LOGIN /dev/pts/14 FROM mach2.Example.COM, then the system is permitting remote root logins. To prevent remote superuser access, change the #CONSOLE=/dev/console entry to CONSOLE=/dev/console in the /etc/default/login file.