Chivers <I/O>

How to Change a Password on an Ubuntu Server

22nd of July 2022 by Corey Chivers

Change the Current User's Password

Executing the passwd command without specifying a username will change the current user's password.

So all you need to do is type the following command and press enter.

passwd

The command will prompt you to enter the current password, then a new password, before finally confirming it by retyping the new password.

Change another User's Password

Executing the passwd command along with a username will change that user's password.

Changing another user's password requires elevated permissions. If you can execute commands as root, you are ready to proceed. Without these elevated permissions, you will not be able to change the password.

So all you need to do is type the following command, substitute <username> with the user's username, and press enter.

sudo passwd <username>

The command will prompt you to enter a new password, before finally confirming it by retyping the new password.