Run terminal as root user by default in Ubuntu

Run terminal as root user by default in Ubuntu

Edit the sudoers file with:

sudo visudo

visudo is a command created with the sole purpose of locking the configuration file for sudo command located at /etc/sudoers

Add to the end of the file:

<username> ALL=NOPASSWD: ALL
image 10 - Run terminal as root user by default in Ubuntu

Syntax is defined as: username hosts=(users:groups) commands so in our case username ALL= NOPASSWD:ALL means that the user can run any command anywhere without password.

Save the file and exit, the next thing is to edit the shell command.

Navigate to Preferences > Profile > Command and check the “Run a custom command instead of my shell” then as a custom command set sudo gnome-terminal

image 11 - Run terminal as root user by default in Ubuntu

That’s it, now every time you open the terminal icon it will start the terminal as root user.

Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.