稍有不慎,在以 root 身份对 ext HDD 进行操作后,我没有使用正确的命令来禁用 root 权限,而是使用了以下语法
sudo -l passwd
我得到了这个输出
/usr/bin/passwd
我从手册页中知道密码,但我不明白这个结果,因为我使用的语法对我来说似乎毫无意义。你能解释一下这个输出背后的逻辑吗?
答案1
您需要的信息位于手册页中sudo
(重点是我的):
-l, --list If no command is specified, list the allowed (and forbidden)
commands for the invoking user (or the user specified by the
-U option) on the current host. A longer list format is used
if this option is specified multiple times and the security
policy supports a verbose output format.
If a command is specified and is permitted by the security
policy, the fully-qualified path to the command is displayed
along with any command line arguments. If command is speci‐
fied but not allowed, sudo will exit with a status value of
1.
因此,sudo -l
告诉您您的用户被允许执行/usr/bin/passwd
。