Managing user passwords is a key part of server administration to ensure security.
If you need to change the SSH password for either the root and sudo users on your server, this guide will walk you through the process.
Note: This is guide is will help someone who already has access to SSH, either by root user or a sudo user, and needs to change the password. If you have no SSH access at all, please contact our support team for help.
Prerequisites:
#
- Root or sudo SSH access to your server.
Step 1: Log in to the Server #
To begin, log in to your server via SSH using the existing credentials. You can refer to this guide
Step 2: Change the Root Password #
- Once logged in as the root user or a user with sudo privileges, you can change the root password by typing the following command:
passwd
If you’re logged in as a sudo user and want to change the root password, run the following command:
sudo passwd root
- You will be prompted to enter and confirm a new password for the root user.
- Enter new password: Type the new root password and press Enter.
- Retype new password: Re-type the password to confirm and press Enter.
- If successful, you will see a confirmation message below;
passwd: all authentication tokens updated successfully.

Step 3: Change the Password for a Sudo User #
If you want to change the password for a sudo user, the process is very similar:
- If you are logged in as the root user, you can change the password for any sudo user by running the command below. Replace
sudo_user
with the actual username of the sudo user whose password you want to change.
passwd sudo_user
E.g to change the password of a user called tkeugene, you will run passwd tkeugene
- You will be prompted to enter and confirm a new password for the sudo user.
- Enter new password: Type the new password for the user and press Enter.
- Retype new password: Re-type the password to confirm and press Enter.
- If successful, you will see a confirmation message below;
passwd: all authentication tokens updated successfully.

Step 4: Verify the Changes #
To ensure the changes have taken effect, you can test the new password by logging into the server using updated credentials, but from a different terminal session while keeping the current one for use, just in case you face a challenge.