Changing the root password on a Linux Server (CLI)
Linux Tutorials

Changing the root password on a Linux Server (CLI)

This guide will show you how to change the root password on a Linux server using the command line interface (CLI). It is important to regularly change this password to ensure the security of your system.

Maciej K
Maciej KJan 7, 2023

The root password on a Linux server is the most important password for the system, as it gives you full access to the server and allows you to perform any action on the machine. It is important to periodically change the root password to ensure the security of your system. In this guide, we will walk you through the steps to change the root password on a Linux server using the command line interface (CLI).

Step 1 - Login to the server

Log in to the server as the root user. We have a guide on how to do this.

Step 2 - Run the passwd command

At the command prompt, type the following command to change the root password:
passwd

Step 3 - Set your new password

You will be prompted to enter the current root password. Type in the current password and press Enter.

You will then be prompted to enter the new root password. Type in the new password and press Enter.

You will be prompted to confirm the new password by typing it in again. Type the new password again and press Enter.

The root password has now been changed.

Conclusion

That's it! You have successfully changed the root password on your Linux server.

Next article

How to install LAMP stack on CentOS 8

Newsletter

Get the most talked about articles directly in your inbox

Every week we share the most relevant news in tech, culture and entertainment.

Your privacy is important to us. We promise to not send you spam!