A quick guide to the `passwd` command, used to change a user's password
Users in Linux have a password assigned. You can change the password using the
There are two situations here.
The first is when you want to change your password. In this case you type:
and an interactive prompt will ask you for the old password, then it will ask you for the new one:
root (or have superuser privileges) you can set the username of which you want to change the password:
passwd <username> <new password>
In this case you don’t need to enter the old one.
passwdcommand works on Linux, macOS, WSL, and anywhere you have a UNIX environment