我是 Linux Mint 系统的唯一用户,我注意到我选择登录的密码与分配给sudo.
所以我的问题是:更改我的登录密码是否也会更改 sudo密码吗?
如果没有,我该如何更改sudo密码?
Áng*_*gel 45
默认情况下,sudo要求输入用户密码。因此,更改用户密码(也用于登录)也会影响 sudo 调用。
但是,您可以/etc/sudoers为您的用户设置rootpw标志,在这种情况下,它会要求输入 root 密码。
sudoers(5) 手册页的相关摘录是:
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.
Run Code Online (Sandbox Code Playgroud)
同样,不要求 sudo 密码的关键字是NOPASSWD。
如果要设置root密码,可以使用 sudo passwd
请注意,在更改 sudo 权限时,建议保持根控制台打开(例如sudo -s),直到在不同的终端中验证它确实有效,并且您还没有锁定自己。
小智 22
没有sudo密码本身。一个用户可以属于该sudo组并运行该sudo命令,但每个用户只有一个密码。当它发生变化时,它会针对用户而不是任何应用程序发生变化。
另一个类似的误解是 root 密码与用于sudoing 的密码相同。不,root是单个用户,有一个私人密码,与任何其他密码无关。