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:

https://lh3.googleusercontent.com/aLUt07cEyuOIHxyILlgoIBZyjGjc_RF9APRkWXB2KWRzLmXEuoWF5JAysXmXU-DaBpofabgpuEHx2lRENV1UndJL-dqWVgJ2laAxjQ3P5nVfH3fLBfOkzuIsI3FVUPYRlum6s2cY


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


https://lh5.googleusercontent.com/gLwbtwt98_w1W44td_2chZfhOExHh6rthxiuSqXc3wNV34HDQSh2vK8aVDnT0yRwbQsBTfOGxv3Kvt8B8NGVsbF5SMcF8KUz0AqRbOt6o1xwh3LAhtoipcmwkbpxngnkhkP4PhMI


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.


https://lh3.googleusercontent.com/486z_clrIcqmULVtW0rw2ZLFU6q7lGya5BcmmxliERdSP8KTI-Fy7uT1Ajx0AXj2JiccYjaLf3t9bm8_VLphhhI_eWZE1A4qgGi0B8CwCQrgX44PWmyvsaOQrzhTROBJj0zXiPx7


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.


https://lh4.googleusercontent.com/LQ9_vgVBcsPOmpGidVu8t0t5aTMey7VMrl5tIEGgMu9UvJQYxHlAqa5RbV2fz4ogkP5L0WI17sW98eiHskZuXanerblKsKvZGo1_UAvdLrjfyNtbG2DQPG0X3bZauU_OAbQAv9_y


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.


https://lh5.googleusercontent.com/Aji8vUfwQtU3Y-SDSgNycTG_mT65g5CFEmFQnMDdU_oB8zQEP0l6rL1JrvEIolm6GkoVzaXl3IYIngTqt9vUlwNGG1BhUnexGtbglA13c09jHe41FBfAuJvExNHyQitYP_9EaWxE

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: ”


https://lh6.googleusercontent.com/gJp1F50B3XeGFrB0PRCHlFzOOWLy8Z50hNwG8Xsgi7SaJLaBrXP6KaENm93FmDvMy1R2vX8gVb-39R1258h_BMM6XHof23S3e3cuTWsZ9VfeKZjU0LIH7DB-sB8u5ZAMeEnsK2Tg

 

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.


https://lh5.googleusercontent.com/1cnFrAMJMwAI2M08HSF4xcWtwLVWjWFQfTnNiI7xNOlgatPQJPsnEy-tUZCG-Mdm4X16h4oJmCDL7wpsG46phtWoqIwXxTVumXzdVMfijHPdk1tkV0kcwC8c0I2wsx4cL_bJTKwk


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.


https://lh3.googleusercontent.com/CEAawBFDgRaRBm1EDILI_Uyg2WxrSiQ8cMSa0FeFnxCiGeUXbxCaJUx-8LZKr1F2o9LSa86uJswxno9vAk99fRBnkH_L_vH9u9MBsGb2kZExJbdjecInCq-bBG7kzxL0wPeWWK2-


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