sudoers 规则已列出但未应用

sudoers 规则已列出但未应用

我有一台 Ubuntu 22.04 LTS VM,我想为特定用户提供无密码 sudo

我创建的/etc/sudoers.d/user内容

user ALL=(ALL:ALL) NOPASSWD:ALL

用户也在该sudo组中,因此

sudo -l

给出了两者

(ALL : ALL) ALL
(ALL : ALL) NOPASSWD: ALL

读这个回答,NOPASSWD 应该起作用,因为它在里面/etc/sudoers.d/,但是没有,仍然要求输入密码


sudoers读 :

# Host alias specification

# User alias specification

# Cmnd alias specification

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

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "@include" directives:

@includedir /etc/sudoers.d

相关内容