Skip to content

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.

See also: Changing your root password on Plesk and cPanel.

Step 1

First, access the server via the SSH interface.

Step 2

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:~#

Step 3

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:~#

Was this article helpful?

Check out some of our related guides

Need a hand? Search over a hundred step-by-step support guides