Skip to content
ZenoCloud Call

How to Change Your SSH Password (Linux passwd Command)

Log in over SSH and run passwd, enter the current password, then the new one twice. Root can reset any user with sudo passwd username.

A matte navy slab with a dark glass face showing one large gold prompt chevron and cursor, on warm paper.

Log in over SSH and run passwd. It asks for your current password, then the new one twice. To reset another user's password, run sudo passwd username as root or a sudo user; it does not ask for the old password.

# your own password
passwd

# another user's password
sudo passwd username

Change your SSH password, step by step

  1. Log in: ssh username@your_server_address.
  2. Run passwd. It prints Changing password for username.
  3. Enter your current password. Nothing is shown as you type.
  4. Enter the new password at New password:, then again at Retype new password:.
  5. Look for passwd: password updated successfully.

Your open session stays connected. The new password applies from the next login, so keep the old session open until you have tested it in a second one.

Terminal session with five numbered steps: log in with ssh username@your_server_address, run passwd, enter the current password (nothing is shown as you type), enter the new password twice, and read the line passwd: password updated successfully.
The five steps as they look in a terminal. Output captured from a real passwd run on Debian 13; your prompts may differ slightly.

If passwd fails

  • BAD PASSWORD: ... means the password broke a complexity rule (too short, too similar to the old one, or a dictionary word). Pick a longer one: 12 or more characters is a good floor.
  • You must wait longer to change your password means a minimum password age is set. Check it with chage -l username (use sudo for other users); the "Minimum number of days" line shows the limit.
  • Authentication failure or Authentication token manipulation error usually means the current password was typed wrong. If it fails with the right one, check for a read-only filesystem or a full disk.

Change an SSH key passphrase

An SSH key passphrase is not your account password. It only locks the private key file on your computer, so passwd never changes it. On the machine that holds the key, run:

ssh-keygen -p -f ~/.ssh/id_ed25519

Enter the old passphrase, then the new one twice. The key stays the same, so nothing changes on the server. Use your own key path if it differs.

Disable password login (use keys)

Once key login works, turn passwords off. In /etc/ssh/sshd_config set PasswordAuthentication no, then run sudo systemctl restart sshd (the service is ssh on some Debian and Ubuntu releases). Test a key login in a second session before closing the first.

On a Managed Server we do this hardening for you, with patching and 24/7 monitoring, from ₹9,999 a month per server.

Next step

Want the server hardened for you?

See Managed Server

Related services

Browse all field notes
Quote request

What should we quote?

Your name, number and what you need. We reply within one business day.