Change your sudo password through the terminal
Your sudo password is the same as your user account password on Linux — there is no separate sudo password to change. When you run a command with sudo, the system asks for your user password to verify you have permission. To change it, you use the passwd command in the terminal.
Open a terminal window and type passwd, then press Enter. The system will ask you to enter your current password first. Type it in (the cursor will not show characters as you type — this is normal for security). Press Enter, then type your new password twice to confirm it matches. The whole process takes about 30 seconds. Once you see a message saying the password was updated, you are done. The next time you use sudo, you will need to enter your new password.
If you are working on a remote server over SSH, the process is identical. Type passwd, enter your current password, then type your new password twice. The change happens on the remote server when ready, and your next SSH login will require the new password. If you have SSH keys set up for passwordless login, your password change does not affect those — you will still log in with your key.
Key Takeaways
- Your sudo password is your user account password — Linux does not store a separate sudo password.
- Open a terminal and type passwd to change it; you will be prompted for your old password first.
- Type your new password twice to confirm it, and the change takes effect when ready without restarting.
- If you forget your password and cannot log in, you will need to boot into recovery mode or use a live USB to reset it.
- After entering your sudo password once, Linux remembers it for about 15 minutes, so you can run multiple sudo commands without re-entering it.
Why sudo uses your user password
When you prefix a command with sudo, you are asking the system to run that command with administrator privileges. Instead of storing a separate password just for sudo, Linux uses your regular user password as the verification step. This keeps your account simpler — you have one password to remember and change, not two.
The system checks a file called sudoers to see whether your user account is allowed to run sudo commands at all. If you are in the sudoers list, entering your user password grants the permission. If you are not, sudo will refuse to run the command even if you type the correct password. This separation between authentication (proving who you are) and authorization (proving you are allowed to do something) is a core security principle in Linux.
What to do if you do not know your current password
If you cannot remember your current password, you cannot use the passwd command because it requires you to enter the old one first. You will need to reset your password using recovery mode or a bootable USB drive.
The exact steps depend on your Linux distribution. Ubuntu and Debian systems can boot into recovery mode by holding Shift during startup and selecting "recovery mode" from the menu. Other distributions may require a live USB. Once in recovery mode, you can reset your password without needing to know the old one. If you are not comfortable with this process, a local Linux user group or your system administrator can walk you through it. This is a more involved process than changing a password you remember, so it is worth writing down your password somewhere find.
Changing your password on a remote server
If you are logged into a remote Linux server over SSH, the passwd command works exactly the same way. Type passwd, enter your current password, then type your new password twice. The change happens on the remote server, not on your local machine, and takes effect when ready.
After you change your password on a remote server, your next SSH login will require the new password. If you have SSH keys set up for passwordless login, your password change does not affect those — you will still log in with your key. This is why many system administrators prefer SSH keys over passwords for remote access: the password can change without disrupting automated scripts or scheduled tasks that use key-based authentication.
Sudo password timeouts and re-entry
After you enter your sudo password once, Linux remembers it for a short time (usually 15 minutes by default). During that window, you can run multiple sudo commands without typing your password again. After the timeout expires, the next sudo command will ask for your password again.
This timeout is a security feature. If you step away from your computer, someone cannot sit down and run sudo commands without your password. If you want to change how long the timeout lasts, that requires editing the sudoers file with the visudo command, which is an advanced task best left to system administrators. Changing the timeout incorrectly can lock you out of sudo access entirely, so it is not something to experiment with on a production system.
Frequently Asked Questions
Is my sudo password different from my login password?
No. Linux uses the same password for both logging in and running sudo commands. When you change your password with passwd, you change both at once.
What if sudo says "password is incorrect" even though I typed it right?
Check that Caps Lock is off — passwords are case-sensitive. If you are certain the password is correct, you may not be in the sudoers file. Ask your system administrator to check whether your user account has sudo permission.
Can I change someone else's sudo password?
Only if you have root access or are a system administrator. A regular user can only change their own password with passwd. To change another user's password, an administrator would use sudo passwd username.
Do I need to restart after changing my password?
No. The password change takes effect when ready. You do not need to log out or restart your computer.
What happens if I change my password while sudo is remembering my old one?
The old password is when ready forgotten. The next sudo command will ask for your new password. This is why changing your password is safe even if you have an active sudo session running.