Using the passwd command you can change the password of your current user – or, as root, the password of any other user – directly on the server.
Log in as root
-
Connect via SSH
Connect to your server via SSH:ssh root@YOUR_SERVER_IP
Change your own password
Run the following command:
passwd
You will be prompted to:
- Enter your current password (non-root users only).
- Enter your new password.
- Re-enter the new password to confirm.
Change another user's password
As root you can set the password of any other user without knowing the old one:
passwd USERNAME
Example:
passwd myuser
Tips for strong passwords
- At least 16 characters.
- Mix of upper and lower case, numbers and special characters.
- No dictionary words and no personal data.
- Use a unique password per service – ideally managed in a password manager.