I was trying to understand why "su" fails and "sudo " is successful.
So, since the root account is disabled by default, the "su" command fails. fair enough.
But the thing that I can't get my grip on is the following:
When a user is trying to execute a command with root privileges a "sudo" is required. I would expect the prompt password to be asking for the "root password" (which at this point, by default, is not set) - as the root privileges are about to be given temporarily to the user.
However, what actually happens is that the user is asked to enter his own password. Could someone explain the logic in this process?
sudois configured by default - you're trusting the user, so ask for the user's password to verify that it is indeed them. You can use
targetpwto ask for the target user's password if you want