12/03/2016

RHEL5, gdm autologin as root

The gnome desktop manager will disregard a gdm/custom.conf configuration to automatically login as the root user and present a standard greeter prompt instead. Normally configuring gdm to autologin as any user other than the root user would not prompt for a password and simply login and present a default graphical desktop. Here is how to configure gdm to autologin as the root user.


create a new regular user account

# useradd testuser

run gdmsetup from a desktop cmdline window,
or use the the gui tool [System]/[Administration]/[Login Screen]



select the [Security] tab
check the [v/] Enable Automatic Login
enter: the  new regular user account

under [Security]
check: Allow local system administrator login
check: Allow remote system administrator login
press [x][Close] to save the changes

edit the /etc/passwd file and make the following changes:

change the uid for the testuser to [0]
change the gid for the testuser to [0]
change the home directory path  [/root]



save the file

reboot

the system will automatically boot into a gnome windows desktop with root privileges

The reason this works is the uid and gid are the same as the root user. Whatever coding intervention prevents the autologon procedure from continuing appears to only inspect the username and not the uid or the gid.

So setting the enabled Automatic Login "user" to something other than "root" is [allowed] and continues without prompting for a normal logon password. Once the session is started, every other program identifies the user as the root user and proceeds as if the root user had logged in.

This could be considered a security [bug], but its really a security "best practice" to not turn-key systems into default insecure tools. There will always be special situations that warrant moderation of a best practice for practical reasons.