我已经修改了 /etc/sudoers 以允许自己在没有密码的情况下执行任何命令,但它没有用,我仍然必须输入密码

问题描述 投票:0回答:1

我已经修改了我的 /etc/sudoers(通过 visudo)以允许自己在没有密码的情况下执行任何命令,但它没有用。

我在使用 sudo 时仍然需要输入密码。

❯ id -nG
guo network power libvirt autologin rfkill users video storage lp audio wheel sudo

系统

❯ uname -a
Linux lead-inspiron 6.2.1-arch1-1 #1 SMP PREEMPT_DYNAMIC Sun, 26 Feb 2023 03:39:23 +0000 x86_64 GNU/Linux

这些是我的 /etc/sudoers 的最后几行

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

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

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

## Uncomment to allow members of group sudo to execute any command
guo ALL=(ALL:ALL) NOPASSWD: ALL

%sudo ALL=(ALL) NOPASSWD: ALL

## Uncomment to allow any user to run sudo if they know the password
## of the user they are running the command as (root by default).
# Defaults targetpw  # Ask for the password of the target user
# ALL ALL=(ALL:ALL) ALL  # WARNING: only use this together with 'Defaults targetpw'

## Read drop-in files from /etc/sudoers.d
@includedir /etc/sudoers.d

如果不输入我的密码我就不能

sudo

顺便说一句,我的母语不是英语,所以对于任何错误,我深表歉意。

linux authentication command-line-interface sudo
1个回答
0
投票

尝试删除当前位置前面的 NOPASSWD 并添加此行:

ALL=(ALL) NOPASSWD: ALL

© www.soinside.com 2019 - 2024. All rights reserved.