While working with the Ubuntu command line, the Terminal, we come across situations that require us to log in as root again and again. Ubuntu does that for protecting our system in order to avoid any user or script that opens the Terminal for any malicious activities that put your privacy and system at risk. Root allows far more access than a standard user needs on the command line. With root in action, features that make Ubuntu more secure are no longer working for you. Just consider running a web browser as root!

Important: Before even explaining how you can launch the Terminal every time in sudo mode, we would like to emphasize as much as we can that it is a very unsafe thing to do.

Anyways, if you really, really are in dire need of a scenario where you want to avoid typing ‘sudo’ and its password with your commands, we will present a solution. But before that, we will also give you a safe alternative so that you can at least save yourself from typing your sudo password for one Terminal session.

We have run the commands and procedures mentioned in this article on a Ubuntu 18.04 LTS system.

First, a Safer Alternative

You might want to avoid typing in your password for a lot of commands that require sudo privileges, all in one Terminal session. The safest approach, in that case, is using the sudo -i command. Open your Terminal either through the Application Launcher search or the Ctrl+Alt+T shortcut. Then type the above-mentioned command as follows:

$ sudo -i

sudo -i command

After you provide the password for sudo, your root session will begin. You can verify your control by using the following command:

# id

id command

After you are done with running all the commands, exit the root prompt by typing the exit command:

# exit

id after exit

You will now be logged out of the root user and continue to perform as an ordinary Ubuntu user.

Launching the Terminal in root mode

Although unsafe, here we will present a solution that ensures that you are already logged in as root whenever you open the Terminal.

First, open the Terminal and open the sudoers file as follows:

$ sudo visudo

Add the following line at the end of the file:


This is how my file looks like with my username:

Editing sudo permissions with visudo command

Save the file by using the Ctrl+x shortcut.

Now is the time to work with the keyboard shortcuts. We will first disable the default shortcut that opens the Terminal. Open the Keyboard shortcuts view from your system Settings. Then, from the Launchers section, click on the Launch Terminal shortcut.

Set keyboard shortcut

At the above view, hit Space+backspace to disable this shortcut.

Now create a new shortcut by clicking on the ‘+’ sign at the bottom of the Keyboard Shortcuts view. Enter the following information in the Add Custom Shortcut view:

Name: Terminal-root

Command: sudo gnome-terminal

Add custom shortcut

Then Set the shortcut as ctrl+Alt+T. Click the Add button and the new shortcut is active.

Now whenever you want to launch the Terminal as root, use the Ctrl+Alt+T shortcut to launch it.

Using root terminal

In the above image, you can see that I ran the apt-get update command without having to specify sudo and its password.

Please do not forget to revert all these changes when you are done with the scenario that requires such a bold step to be taken. After all, the security of your files and your overall system is more important to you than having to type sudo and its password.

Always Launch Terminal as root User (sudo) in Ubuntu