How to Change Root Password in Ubuntu 24.04

change root password on ubuntu

In Linux, the “root” login refers to the process of logging into a system as the superuser, also known as the root user. The root user has the highest level of privileges on a Linux system, allowing them to execute any command, access any file, and modify any system setting.

In this tutorial, we will guide you to change the root password in Ubuntu 24.04 LTS.

Prerequisites

Ubuntu 24.04 server

Root/sudo privileges

Changing root password in Ubuntu 24.04

Login to your server (either directly or by using SSH). Open up the terminal (either from Show Apps or by using shortcut key CTRL + ALT + T).

To change root password without login from root. You will need sudo privileges for this method. Execute on the terminal.

sudo passwd root

Enter the new password twice for confirmation and hit Enter from the keyboard. Ignore the bad password message.

You can also change the password by login with root account first. Assuming you are login with root, execute the following:

passwd

Provide the same password twice for confirmation. Make sure both password matches.

You have successfully changed the password by both methods . You may login to the server with the new password.

Good luck and Keep visiting Linux World.