Sudo

儘管在組輪中,sudo 仍然要求輸入密碼

  • May 16, 2021

幫我調試一下。sudo儘管設置正確(我相信),當我為命令添加前綴時,系統仍提示我輸入密碼。

  1. 我在群裡wheel
[dilawars@chutki build (master)]$ groups
network power users storage lp input audio wheel dilawars
  1. 我使用visudo.

##
## User privilege specification
##
root ALL=(ALL) ALL

## Uncomment to allow members of group wheel to execute any command
# %wheel ALL=(ALL) ALL

## Same thing without a password
%wheel ALL=(ALL) NOPASSWD: ALL

我已經註銷並多次登錄,但每當我說sudo cmd時,都會提示我輸入密碼!

我在 Majaro Linux 上。

更新

  • 我注意到輸出中的以下行strace sudo ls
write(2, "effective uid is not 0, is /usr/"..., 133effective uid is not
0, is /usr/bin/sudo on a file system with the 'nosuid' option set or
an NFS file system without root privileges?) = 133

使用者可能匹配多個規則。在這種情況下,最後一個匹配規則獲勝。所以,如果你搬家:

%wheel ALL=(ALL) NOPASSWD: ALL

到文件末尾,它應該可以工作。

引用自:https://unix.stackexchange.com/questions/649894