In Ubuntu, the mechanism that prevents the user from logging in as root is the login manager. Ubuntu uses GDM by default, so the instructions will be different under Xubuntu and Kubuntu, or if you have changed your Display Manager/Login Manager.
To configure GDM to allow root login, the file
/etc/gdm/gdm.conf-custom needs to be modified.
The reason you modify this file instead of the
/etc/gdm/gdm.conf file is the the latter can be changed during an update, and in later versions of GDM, the gdm.conf-custom file has been provided for user overrides of settings. Any changes in the
/etc/gdm/gdm.conf-custom file will take precedence.
Under the [security] section, add the following entry:
This will only allow root logins from the local terminal. If you are using a remote X session, you will still not be able to login as root unless you override the AllowRemoteRoot setting.
You might also like the following…
How to enable SSH for Root under CentOS