Skip to main content

How to change the root password on a server

To change the root password in a GNU/Linux-based OS, you should use passwd.

Passwd is a console utility. To use it, you should connect to the server via SSH.

If your computer is using an OS based on GNU/Linux, you probably already know how to use an SSH client.

If your computer is using Windows OS, we recomment opting for the PuTTY utility to connect to the server via SSH. You can download the utility for free on its official website https://www.putty.org

This is what the main window of PuTTY looks like:

Root password change 1

All the necessary settings are set by default. To connect to the server, just enter its IP address in the "Host NAme (or IP address)" field. If a custom port (different from port 22) is used on the server, you will also need to specify it.

Click the Open button after entering the IP address. You will see a server connection window, where you will need to enter the username: root

Root password change 2

After you enter the root username, you will be prompted to enter the password.

Please note that the password you will be entering won't be displayed.

Root password change 3

After you enter a correct password, you will see a command line interface. It will mean that you have connected to a server via SSH, and the server is ready to receive commands from you.

If FASTPANEL is installed on the server, the server information will be displayed once you have connected to it.

Root password change 4

Let's start changing the password. To do it, enter the passwd command in the PuTTY window and click Enter The server will display “Changing password for user root. New password:". It will mean that you can enter a new root password to update it.

Root password change 5

Enter the new password and click Enter.

Please note that the password you will be entering won't be displayed.

The server will prompt you to retype the updated password: “Retype new password: ”

Root password change 6

Enter the new password once again and click Enter. This step is intended to ensure that you've correctly entered your new password.

After you re-enter the right password, the server will display “passwd: all authentication tokens updated successfully”, which means that the password has been updated. You will also see a green cursor blinking, tempting you to enter a new command.

Root password change 7

If you have enter a wrong password, the server will inform you about it displaying “Sorry, passwords do not match.” You will need to re-enter the new password.

Root password change 8

That's all. Don't forget to use the updated password when you connect to the server again.