Why is the 'sudo' password different than the 'su root' password

Contrary to what their most common use would lead you to think, su and sudo are not just meant for logging in (or performing actions) as root.

su allows you to switch your identity with that of someone else. For this reason, when you type su, the system needs to verify that you have the credentials for the target user you're trying to change into.

sudo is a bit different. Using sudo allows you to run certain (or all, depending on the configuration) commands as someone else. Your own identity is used to determine what types of commands sudo will run for you under someone else's identity: if you're a trusted user (in the sense that the sysadmin trusts you), you'll be allowed more free rein than, say, an intern. This is why sudo needs to verify your own identity rather than that of the target user.

In other words, trying to su to someone you're not is like attempting to charge your purchases to a stolen credit card while using sudo is like selling your friend's car by legal proxy.

As for what you were trying to do, just sudo su root, or even more simply sudo su and type your regular user password. This would roughly amount to replacing your friend's credit card credentials with your own using the legal proxy they gave you :). It of course assumes the sudo configuration allows you to run su with escalated privileges.

Also, systems that come pre-configured with sudo access typically have the root account disabled (no root password), you can enable that using the passwd command after becoming root via sudo su.


It is configurable* but, by default, "sudo" asks you for your password. It is just trying to make sure that it is you, not someone using your keyboard while you were getting coffee.

By contrast, "su root" asks you for the root password.


*If targetpw in /etc/sudoers is false (default), "sudo" asks you for your password. If it is true, then "sudo" asks you for the password of root or, if you specified some other user with the "-u" option, the password of that user.


sudo is used to temporarily escalate user permissions to root level, whereas su root is used to create a new shell with root as a user;