Will changing the password of some user also change the sudo password

passwordsudo

I am the only user of my Linux Mint system and I noticed that the password I chose to login is the same that got assigned to sudo.

So my question is: Will changing my login password also change the sudo password?

If not, how can I change the sudo password?

Best Answer

By default, sudo asks for the user password. Thus, changing the user password (which is also used for login), will also affect sudo invocations.

However, you can set in the /etc/sudoers for your user the rootpw flag, in which case it would ask for the root password instead.

The relevant excerpt from the sudoers(5) man page is:

Authentication and logging
 The sudoers security policy requires that most users authenticate them‐
 selves before they can use sudo.  A password is not required if the
 invoking user is root, if the target user is the same as the invoking
 user, or if the policy has disabled authentication for the user or com‐
 mand.  Unlike su(1), when sudoers requires authentication, it validates
 the invoking user's credentials, not the target user's (or root's) cre‐
 dentials.  This can be changed via the rootpw, targetpw and runaspw
 flags, described later.

Similarly, the keyword for not requesting a password for sudo is NOPASSWD.

If you want to set the root password, you can use sudo passwd

Note that when changing sudo permissions, it is recommended to keep a root console open (eg. sudo -s) until it is verified in a different terminal that it indeed works, and you haven't locked out yourself.

Related Question