Regular Ubuntu users require administrative privileges for a bundle of daily tasks. For example, they may have to add or remove any program. There are two options, they either use a root account or sudo command. The same goes for configuration system settings. 

All Linux-based operators work the same way, not just Ubuntu or Ubuntu 22,04. This is a complete guide about how to switch from user to root account on Ubuntu 22.04.

Method 1: Use sudo Command

Using sudo command is one of the most simple ways to use administrative privileges. If you are not a root user, you just add sudo at the start of command, and the system will allow you to do it as root, after asking the password. 

Let’s say, you want to update “package index files” on the system. These files are about available packages and their versions. Here is the command to update all packages. 

$ sudo apt update

Method 2: Login to Root User Account

Sometimes, it is important to login as a root account. Typing sudo is not enough. The command sudo -i allows you to login as a root user. Once you login, you will not always have to type sudo. 

$ sudo -i

How to Find if you are Using Root or Normal Account

A simple command “whoami” helps you figure this out. 

$ whoami

Find the List of All Users

If you want to switch from root to normal user, you should know the IDs of other users. Here is the command to find out the list of users. 

$ sudo cat /etc/passwd

Switch to Specific User

Here is the command for switching to a specific user. Do not forget to replace “username” with the ID of the user you want to switch to. 

$ sudo su username


The command sudo -i lets you switch from user to root on Ubuntu 22.04. Root user is the most important user in all Linux systems. Experts recommend not using root user for a regular system task, because it can lead to serious security consequences.