In order to set a new root password, make sure you’re logged into the correct server and the session is running as root.
Then, run a “passwd root” to invoke the password change command. Enter the new password twice to successfully change the password.
This indicates that root password was successfully changed. The same procedure can be applied to any user on the server by replacing root with any other username.