In this article, I’m going to show you how to graphically login as root in Ubuntu. This is a generally considered a terrible idea and you should not do this. In fact, if you have a good reason for doing this, please leave a comment letting us know what that reason is. Thanks!
A couple of days ago, I told you how to enable root in Ubuntu. In that article, I explained why enabling login as root was a bad idea and unnecessary for most people. I still told you how to do it, just as I’ll tell you how to graphically login as root in Ubuntu and maybe some of the official Ubuntu flavors.
I should remind folks that this is a terrible idea from a security perspective – especially if you don’t have good physical security. However, if you don’t have good physical security then your computer is already easily compromised by anyone with a live USB in their pocket.
NOTE: This is only sure to work for Ubuntu. It looks like it should work from 18.04 to at least 20.10, and will probably continue to work until Ubuntu moves on from GDM3. (GDM3 is Gnome Display Manager 3, a drop-in replacement for GDM.) This may work for other Ubuntu flavors, I haven’t tested. If you do test or know, please leave a comment below. Thanks!
Anyhow, on with the explaining how to graphically login as root. This shouldn’t take too long!
GUI Login As Root:
The first step is to set up the system so that you can login as root. To do that, you should read this article and learn how to enable root login for Ubuntu. Be sure to read the warnings on that page and think carefully before doing this to your own computer.
After enabling root login, the next step is to open your default terminal. You can do that by pressing CTRL + ALT + T.
Now, let’s temporarily make you a superuser. You can do that with:
Our next step is to tell the aforementioned GDM3 to let us use the root login.
You’re going to arrow down to just below the automatic login configuration text and enter this line:
Then, you’ll save the changes by pressing CTRL + X, then Y, and then ENTER. See? Now you’ve edited and saved a file in the terminal with nano. It gets easier the more often you do it!
Next let PAM know:
Your next step is going to be telling PAM (Pluggable Authentication Modules) that logging in as root is okay. That’s pretty easy, and we’ll do it with nano just like above.
Scroll down and look for this line:
What you’re going to do is ‘comment it out’, by adding the # symbol which means, in this case, ‘ignore this line’. Change that line so that it looks like this:
Now, save it just like you did above. (Press CTRL + X, then Y, and then ENTER.) As you’re still using ‘sudo su’, you can get out of that mode by simply typing:
That’s it, actually! When you next reboot or logout, you can login as root. To do so, you need to click on ‘Not Listed’, type in ‘root’, and then enter your password. It should look pretty much like the following images:
Tada! You’ll be logged in as root for no good reason and with almost no benefits! Congratulations! Now, undo it and go back to being a bit more secure. Or not… I don’t mind. It’s your computer. You do what you want!
Please just don’t let your box get owned and turned into something malicious like a spam bot or a node in bot network used to do things like DDoS sites for money. Don’t let your computer make you a bad netizen.
And there you have it! You can now login as root in the GUI and use Ubuntu as root. This is, of course, a terrible idea – but you can do it. If you’re ever in a position where this seems like the best solution, be sure to ask around to see if there are better ways to accomplish your goals. If you can login as root, so can’t someone else! Either way, it’s another article in the books!