After installing Ubuntu 22.04, you will inevitably be logging into the root account, or using administrator privileges, quite frequently. That’s because installing or removing software, as well as configuring system settings, requires the use of the root account or sudo command.
This isn’t just unique to Ubuntu, but actually all Linux systems. In this guide, we’ll show you how to change to the root account on Ubuntu 22.04 Jammy Jellyfish, and how to use sudo to execute commands with root privileges.
In this tutorial you will learn:
- How to use
- How to login to root account
- How to open a terminal as the root user
|Category||Requirements, Conventions or Software Version Used|
|System||Ubuntu 22.04 Jammy Jellyfish|
|Other||Privileged access to your Linux system as root or via the
|Conventions||# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
Change to root user in Ubuntu 22.04
- In Ubuntu, usually you will just preface a command with
sudoif you need to execute it with root permissions. You will be prompted for your password if you haven’t recently authenticated. Here’s an example:
$ sudo apt update
- Alternatively, you can execute the
sudo -icommand to login to the root user account. Once logged in, you won’t need to use the
sudocommand at all.
$ sudo -i
To confirm which user you are logged in as, you can execute the
$ whoami linuxconfig
Or when logged into root:
# whoami root
Open terminal as root user
To open a terminal as the root user, usually you would just execute the
sudo -icommand inside a new terminal. If, instead, you want to open a brand new terminal as the root user, you can execute the following command:
$ sudo gnome-terminal
Knowing how to access the root account on your Ubuntu 22.04 system is absolutely essential if you want to carry out any type of system administration task. We went over a few options here, including the
sudo command, or elevating directly to the root user account.