The root user (or superuser) is a separate user account for both Linux and Unix-like platforms. It has complete and unrestricted access to all commands and resources on the machine. If you're switching from another Linux distribution to Ubuntu, you may be wondering what is the Ubuntu default root password is and how to change it. The root user account is not enabled by default in Ubuntu for safety reasons. In this guide, we will discuss about switch to root user on Ubuntu and establish the root password on Ubuntu platforms.

Temporarily Switch to Root on Ubuntu

By assigning sudo rights to everyday users, Ubuntu users are encouraged to conduct server administrative tasks. Registered users can run programs as another user, normally the root user, using the Sudo command.

The sudo community is now a part of the initial user generated by the Ubuntu installer. It's likely that the person you're now logging in as has administrative rights. To briefly escalate root user rights, run the following command with the sudo prefix:

Sudo name

The very first moment you use sudo in a process, you'll be prompted for the user password.

To briefly switch to the root account in the current login session, use sudo su or sudo -i command and insert the user password:

sudo su 


sudo -i

To ensure that the user has been updated as root, use the whoami command:




Modifying Ubuntu Root Password

Since the root user has been disabled, this does not imply that the root account has been deleted. Since the root account has no password, logging in as root is not feasible.

All users have to do is open the root account to create a password for the system administrator. The passwd command in Ubuntu allows you to set or change a user account's password. When generating the password, make sure to use a strong and exclusive password

The most critical part of your account's protection is using a secure password. A good password usually consists of at least sixteen characters, an uppercase letter, a lowercase letter, an integer, and a special character. To change the root user's password in Ubuntu, type the command given below as a Sudo user:

sudo passwd root

You will be asked by the following command to enter and confirm the new root password. You will be prompted to retype it again. When you enter the password, it does not appear on the page. When you have successfully entered the new password, you will see the following output:

passwd: password updated successfully

The password for the Ubuntu root account has been updated. Users can now sign in to the Ubuntu system as root using the latest password.


The root account in Ubuntu has no password by default. The Sudo command is recommended for executing commands with root privileges. Before you could even log in as root, you will be needed to set the root password. We hope that the given information will help you to understand why the root user is not enabled by default.

Seamlessly integrate with various Linux-based applications and enjoy the flexibility to scale resources as required. Take advantage of the opportunity to buy a Linux VPS from 1gbits and unlock a world of possibilities for your online presence.

FAQs About Ubuntu Switch to Root

  1. What is the 'root' user in Ubuntu?

    • The 'root' user is the administrative user in a Linux environment like Ubuntu. It has very broad privileges and is used for tasks that require higher permissions.
  2. How do I switch to the root user in Ubuntu?

    • You can switch to the root user by typing sudo -i or sudo su in the terminal. This will prompt you for your password. Once entered correctly, you will be operating as the root user.
  3. Why can't I log in directly as root?

    • Ubuntu, by default, does not allow direct login as root for security reasons. This helps prevent accidental damage to the system and reduces the risk of external attacks.
  4. What is the difference between 'sudo' and switching to root?

    • 'sudo' allows a permitted user to execute a command as the root user, whereas switching to root means you are operating as the root user for all commands until you exit.
  5. Is it safe to use the root user for regular tasks?

    • No, it's not recommended. Using the root user for routine tasks can lead to accidental system modifications or data loss. It's safer to use a regular user account and only switch to root when necessary.
  6. How do I exit from the root user?

    • Type exit in the terminal. This will return you to your normal user account.
  7. What should I do if I forget the root password?

    • Ubuntu doesn't set a root password by default. If you've set one and forgotten it, you can reset it using your regular user account (if it has sudo privileges) or by booting into recovery mode.
  8. Can I run graphical applications as root?

    • While it's possible, it's generally not recommended due to security risks. If necessary, use gksudo for GTK applications or kdesudo for KDE.
  9. How do I perform system updates as root?

    • System updates should be performed using the sudo apt update and sudo apt upgrade commands rather than switching to root.
  10. What is the 'root' directory? Is it related to the root user?

    • The 'root' directory, denoted as /, is the top-level directory in a Linux filesystem. It's not directly related to the root user, despite sharing the same name.

People also read: