Justin Merrill

Engineer | Cloud | DevSecOps | SRE | K8s | GitOps | IaC | Data | APIs | BS | MBA

Linux

Log In as root from Unity GUI on Ubuntu 16.04 & 16.04.2 LTS Server

Security Disclaimer:

There is a PROFOUND argument AGAINST enabling the root user among the extremely seasoned (& sometimes pretentious) Linux and Ubuntu communities, so this tutorial is PURELY  intended for use for a testing or home use environment on a machine (even virtual) that doesn’t contain sensitive information.

For example: You having a testing or staging environment that is within your internal network at work or home, perhaps even running as a Virtual Maching (VM). You want the ability to access this environment remotely from any web browser or mobile device. Having the Unity GUI installed provides many tools for editing databases with feature rich clients like Navicat or editing code with advanced debugging tools on IDE’s like NetBeans or even SublimeText. You can also get a better view of all your Git branches with better organized and color coded clients like Git GUI or SmartGit. The benefits to having quick access to a GUI that rides on a system integral to your development process can really come in handy, and provide easy access and configuration, even if it is only for your personal use.

Why use the bloated Unity Linux desktop? Why not use something more lightweight?

There really isn’t a great answer to give here for any additional nerd cred. Using a “known only to a chosen few” desktop that is ultra lightweight might be more ideal for performance. But the Unity Desktop for Linux has a very significant and profound advantage that most other Ubuntu Desktops do not:

Familiarity

Whether you are running a few little test servers from an Ubuntu Desktop installation, or you are adding a Desktop GUI to an Ubuntu Server Installation, if your system is only accessible to internal network users having root enabled should not be a security issue unless you are dealing with highly sensitive data. Oh, you’re just running a Laravel, Ember.js or WordPress Multisite test server with a Virtual Machine for experimentation or presentation? Perfect. Save yourself some headache & keystrokes by logging in as root to fix and tweak certain applications. Everyone loves ‘sudo’, but if it’s not going to make me a sandwich, I’d like to go and eat lunch sometimes. Hopefully this tutorial will save you enough time to enjoy the rare and elusive “lunch break” those folks in IT seem to enjoy for a large part of the day…

Here we go:

The permanent way is:
1:
Open a terminal windows and set-up a root password:

Retype your choosen password, twice:
You should get the response:

2:
Go to:

Use your editor (e.g. gedit, nano, vim, etc) and type:

Add the following line to the file:

Save file (eg: “save” or Ctrl+S>Ctrl+x, etc)
Reboot or shut down Linux and then start again.
You will now be given a greeter which will allow you to log in directly as root. This will occur everytime you log in from now on.

However, in most cases log-in as an ordinary user and then use a shell and type:

This will ask for the root password. Enter it and you should be logged in as root and no longer need to use the sudo prefix to your commands that require elevated privileges.

I ran into the issue of seeing the “GUI showstopper” error in a prompt window of:

This was a relatively simple fix from the root users profile configuration

1) Open /root/.profile

2) Comment or Remove the offensive line mentioning mesg

3) Replace it with:

The contents of the file will look something like this when you are done:

Shut down Linux and then start again (or reboot).
You will now be given a greeter which will allow you to log in directly as root. This will occur everytime you log in from now on.

So now, not only will you be able to login from the welcome login screen as any added “non-hidden” user, but you will also have the ability to login with root and other users you may need to test various permissions and applications with.

I know its not safe and secure or anything but maybe it’ll save you some time and trouble down the road. Pretty cool, right?

Leave a Reply

Your email address will not be published. Required fields are marked *