我有一台 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