Changing your root password on an Ubuntu server
You can change your root password on your Ubuntu server via SSH with some simple commands whenever you need to by completing the following steps.
First, access the server via the SSH interface.
If you are logged in as the root user, then you only need to type:
sudo passwd root
As shown in the example below:
root@UbuntuServer:~# sudo passwd root New password: Retype new password: passwd: password updated successfully root@UbuntuServer:~#
If you are logged in as a user that already has root permissions, then you will not need to type ‘sudo‘.
You can also set the ‘root’ to be a different user if you have multiple users set up.
In this case, you can type ‘passwd‘ alone and it will change the password for the current user.
Here’s an example of a use with root privileges changing their own password with the shorter command:
root@UbuntuServer:~# passwd New Password: Retype new password: passwd: password updated successfully root@UbuntuServer:~#